Skip to content

Commit 37432b7

Browse files
committed
Update solution 070 [Python3]
1 parent cb614bc commit 37432b7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def climbStairs(self, n):
3+
"""
4+
:type n: int
5+
:rtype: int
6+
"""
7+
if n<3:
8+
return n
9+
res=[None]*(n+1)
10+
res[1]=1
11+
res[2]=2
12+
for i in range(3,n+1):
13+
res[i]=res[i-1]+res[i-2]
14+
return res[n]

0 commit comments

Comments
 (0)