递归_青蛙跳台阶
作者:互联网
# -*- coding:utf-8 -*-
class Solution:
def jumpFloor(self, number):
# write code here
f1=1
f2=2
if number<=0:
return 0
elif number<3:
return number
else:
for i in range(3,number+1):
f3 = f1+f2
f1 = f2
f2 = f3
return f3
标签:f1,f2,code,台阶,递归,jumpFloor,青蛙,number,utf 来源: https://blog.csdn.net/m0_52701514/article/details/120105542