This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingCompute the nth Fibonacci number with a table instead of a branching recursion.
What this asks
Compute the nth Fibonacci number.
Seed 0 and 1, then fill a table left to right with dp[i] = dp[i - 1] + dp[i - 2]; because the transition only ever reads two entries back, the table collapses into two variables.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing