Create 2 - Fast Fibbonacci.py
This commit is contained in:
parent
34c647744f
commit
7565402ea6
5
18/2 - Fast Fibbonacci.py
Normal file
5
18/2 - Fast Fibbonacci.py
Normal file
@ -0,0 +1,5 @@
|
||||
def Fibonacci(n):
|
||||
sequence = [0, 1, 1] # Fibonacci(0) is 0, Fibonacci(1) and Fibonacci(2) are 1
|
||||
for i in range(3, n+1):
|
||||
sequence.append(sequence[i-1] + sequence[i-2])
|
||||
return sequence[n]
|
Loading…
Reference in New Issue
Block a user