一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法
class Solution: def jump(self,n): if n ==0: return 0 elif n==1: return 1 elif n ==1: return 2 numN = 0 first = 1 second = 2 for i in range(3,n+1): numN = first+second first = second second = numN return numN if __name__ =='__main__': solution = Solution() time = solution.jump(5) print(time)