Skip to content

Commit 7f64711

Browse files
committed
feat: add climbing stairs solution
1 parent fa8a2f3 commit 7f64711

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

climbing-stairs/mangodm-web.py

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

0 commit comments

Comments
 (0)