Skip to content

Commit c2a3573

Browse files
Create Climbing Stairs.py
1 parent 53e3161 commit c2a3573

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Arrays/Easy/Climbing Stairs.py

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

0 commit comments

Comments
 (0)