Bootstrapping Fibonacci

What happens when we run this code?

1
2
3
4
5
6
7
8
fib_history = {1:1};

def fib_memo(n):
    if n not in fib_history:
        fib_history[n] = fib_memo(n - 2) + fib_memo(n - 1)
    return fib_history[n]

print fib_memo(10)   

×

Problem Loading...

Note Loading...

Set Loading...