class Solution:
# @param {integer} n
# @return {integer}
def climbStairs(self, n):
step=[0 for i in range(n+2)]
step[0]=1
step[1]=2
if n<=2:
return step[n-1]
for i in range(2,n):
step[i]=step[i-1]+step[i-2]
return step[n-1]
Climbing Stairs
最新推荐文章于 2024-08-31 00:26:34 发布