class Solution:
def Fibonacci(self, n):
# write code here
if n == 0:
return 0
elif n == 1 or n == 2:
return 1
else :
a = 1
b = 1
for i in range(3,n):
c = a+b
a = b
b = c
return a+b
网友评论