Code
The highlighted line runs next. The pill shows the live values in the running call.
Variables
The data structures the code is building
Staircase
The number on each step is filled in as it is computed
A staircase has n steps. Each move climbs 1 or 2 steps. Return the number of distinct ways to reach the top.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
The number on each step is filled in as it is computed
n = number of steps. The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. n from 1 to 45; drawings are capped at n = 6 for plain recursion, 12 for top-down and 20 for the loops.