解题思路
class Solution:
def climbStairs(self, n: int) -> int:
f = [1, 2]
for i in range(2, n):
f.append(f[i-1] + f[i-2])
return f[n-1]
参考链接
https://leetcode-cn.com/problems/climbing-stairs/solution/solution-python3-by-bu-zhi-dao-gan-sha/