LeetCode70爬楼梯
未经博主同意,禁止瞎JB转载。
LeetCode70爬楼梯
https://leetcode-cn.com/problems/climbing-stairs/description/
斐波那契数列
动态规划
我的解法:
1 class Solution(object): 2 def climbStairs(self, n): 3 """ 4 :type n: int 5 :rtype: int 6 """ 7 ret = [0,1] 8 for i in range(n): 9 ret.append(ret[0]+ret[1]) 10 ret.pop(0) 11 return ret[-1]