Code
The highlighted line runs next. The pill shows the live values in the running call.
Variables
The data structures the code is building
The circle
House 0 and the last house are neighbours (red line)
The houses stand in a circle, so the first and last houses are neighbours. You can't rob two neighbouring houses. Return the most money you can rob.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
House 0 and the last house are neighbours (red line)
n = len(nums). The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. 1 or more amounts from 0 to 200; drawings use at most 6 houses for plain recursion, 10 for top-down and 12 for the loops.