Skip to content

Commit 9e576b8

Browse files
committed
[main] climbStairs solution
1 parent ccaf0e0 commit 9e576b8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

climbing-stairs/jeongyunjae.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+
dp = [-1]
4+
5+
for i in range(1,n+1):
6+
if i == 1 or i == 2:
7+
dp.append(i)
8+
continue
9+
10+
dp.append(dp[i-1] + dp[i-2])
11+
12+
return dp[n]

0 commit comments

Comments
 (0)