class Solution:
def Fibonacci(self, n):
# write code here
if n == 0:
return 0
if n == 1:
return 1
lst = [0,1]
i = 2
while i <= n:
lst.append(lst[i-1] + lst[i-2])
i += 1
return lst.pop()
sol = Solution()
print(sol.Fibonacci(3))
剑指offer习题7
猜你喜欢
转载自blog.csdn.net/u012693077/article/details/80788173
今日推荐
周排行