def Fibonacci(self, n): res = [0, 1] while len(res) <= n: res.append(res[-1]+res[-2]) return res[n]
# -*- coding:utf-8 -*- class Solution: def jumpFloor(self, number): a = [0, 1, 2] while len(a) <=number: a.append(a[-1] + a[-2]) return a[number]
def jumpFloorII(self, number): if number <= 1: return number return 2 * self.jumpFloorII(number - 1)
原文:https://www.cnblogs.com/rnanprince/p/11600976.html