본문 바로가기

Algorithm/leetcode(python)5

[leetcode] 1010. Pairs of Songs With Total Duration Divisible by 60 rithm/leetcode(python 1. 문제분석 https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60/ Pairs of Songs With Total Durations Divisible by 60 - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 난이도 : easy 2. 풀이 - 첫번째 시도는 Naive 하게 무작정 하나씩 해보는거다. class Solution: .. 2020. 7. 15.
[leetcode] 509. Fibonacci Number (2) https://leetcode.com/problems/fibonacci-number/solution/ Fibonacci Number - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 3. 다른풀이 라고 했지만 일단 solution으로 나와있는 모든 풀이를 하나씩 살펴보자. 1) Recursion 위의 그림이 재귀 방법으로는 문제 풀이가 어렵다는 점을 잘 설명해주고 있다. 시간 복잡도 : O(2ⁿ). 피보나치 수열문제를 해결하는 가장 "느린" 방법이다. 위와 같은.. 2020. 7. 14.
[leetcode] 509. Fibonacci Number 1. 문제분석 https://leetcode.com/problems/fibonacci-number/ Fibonacci Number - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 난이도 : easy Note: 0 ≤ N ≤ 30. 피보나치 수열 문제이다. 원래 피보나치 수열을 몰랐더라도 식이 그대로 나와있기에 상관 없다. 식을 그대로 알고리즘으로 구현 하는 문제이다. 포인트 - N이 30까지 갈 수 있다. 2. 풀이 - 첫번째 시도는 재귀호출이었다. class.. 2020. 7. 6.
[leetcode] 27. Remove element 1. 문제분석 https://leetcode.com/problems/remove-element/description/ Remove Element - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 난이도 : easy 간단히 nums 라는 array와 val이라는 값이 주어질텐데 , nums에서 val과 같은 원소들을 지우고 남은 array의 길이를 반환하는 문제이다. 영어로 읽었을때는 잘 안와닿았는데 예시를 보면 바로 무슨 말인지 알 수 있었다. 중요한 점은 따로.. 2020. 7. 3.