Skip to content

Commit abda699

Browse files
committed
climbing-stairs solution
1 parent 306ac37 commit abda699

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

climbing-stairs/yyyyyyyyyKim.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+
4+
if n <= 3:
5+
return n
6+
7+
a, b = 1, 2
8+
9+
for i in range(3,n+1):
10+
a, b = b, a+b
11+
12+
return b

0 commit comments

Comments
 (0)