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
$ = cost on each step; the number above it is filled in as it is computed
cost[i] is what you pay to step off floor i; then you climb 1 or 2 floors. You may start on floor 0 or 1. Return the minimum cost to reach the top, just past the last index.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
$ = cost on each step; the number above it is filled in as it is computed
n = len(cost). The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. 2 or more costs from 0 to 100; drawings use at most 5 steps for plain recursion, 10 for top-down and 14 for the loops.