Code
The highlighted line runs next. The pill shows the live values in the running call.
Cost
Work done so far, and how the five solutions compare
Histogram
Filled: the rectangle being measured. Green outline: best so far
The highlighted line runs next. The pill shows the live values in the running call.
Work done so far, and how the five solutions compare
Filled: the rectangle being measured. Green outline: best so far
Keyboard: ← → step, Space play or pause. 1 to 12 bars with heights 0–20. In the divide & conquer trace, the segment-tree query itself is shown as one step (it costs O(log n)); the code for it is in full on the left.