Skip to content

Commit 356bfbb

Browse files
committed
climbinb-stairs
1 parent c27793a commit 356bfbb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

climbing-stairs/changhyumm.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def climbStairs(self, n: int) -> int:
3+
if n <= 1:
4+
return 1
5+
dp = [0] * n
6+
print(dp)
7+
dp[0] = 1
8+
dp[1] = 2
9+
10+
for i in range(2, n):
11+
dp[i] = dp[i-2] + dp[i-1]
12+
return dp[-1]

0 commit comments

Comments
 (0)