IT_World
[leetcode] 70. Climbing Stairs 본문
class Solution:
def climbStairs(self, n: int) -> int:
if n < 3:
return n
else :
return self.climbStairs(n-1) + self._climbStairs(n-2)
def _climStairs(self, n: int):
if n not in self.cache.keys() :
self.cache[n] = self.climbStairs(n)
return self.cache[n]
'Coding test > programmers - single' 카테고리의 다른 글
[leetcode] 83. Remove Duplicates from Sorted List (0) | 2022.04.03 |
---|---|
[leetcode] 88. Merge Sorted Array (0) | 2022.04.03 |
[leetcode] 39. Combination Sum (0) | 2022.04.01 |
[leetcode]77. Combinations (0) | 2022.03.31 |
[leetcode]78. Subsets (0) | 2022.03.30 |
Comments