class Solution:
def jumpFloor(self, number):
# write code here
if number==0:
return 0
elif number==1:
return 1
elif number==2:
return 2
res=[]
res.append(0)
res.append(1)
res.append(2)
for i in range(3,number+1):
res.append(res[i-1]+res[i-2])
return res[-1]
Solution=Solution()
num=Solution.jumpFloor(35)
print(num)
跳台阶——Python
最新推荐文章于 2024-07-02 05:31:18 发布