8000 11 dec · khemssharma/leetcode@f9687f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9687f3

Browse files
committed
11 dec
1 parent 62c0478 commit f9687f3

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

Dynamic Programming/climbingStairs

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

0 commit comments

Comments
 (0)
0