Skip to content

Commit fbbbae1

Browse files
committed
climbing stairs solution
1 parent 61b0e11 commit fbbbae1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

climbing-stairs/mrlee7.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+
stairs = {1: 1, 2:2}
4+
5+
for i in range(3, n + 1):
6+
stairs[i] = stairs[i - 1] + stairs[i - 2]
7+
8+
return stairs[n]

0 commit comments

Comments
 (0)