diff --git a/18/2 - Fast Fibbonacci.py b/18/2 - Fast Fibbonacci.py new file mode 100644 index 0000000..c7967e7 --- /dev/null +++ b/18/2 - Fast Fibbonacci.py @@ -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]