Quant Memo
Coding/●●●●

Fibonacci, from exponential to linear

The naive recursive Fibonacci

fib(n) = fib(n-1) + fib(n-2),  fib(0) = 0,  fib(1) = 1

takes seconds for n = 35 and effectively never finishes for n = 60.

Explain why the naive version is exponential, then fix it. Aim for O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions