递归_青蛙跳台阶

# -*- 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
        
        
上一篇:Linux中的硬链接和软链接


下一篇:21牛客9C - Cells(LGV引理)