Code
The highlighted line runs next. The pill shows the live values in the running call.
Variables
The data structures the code is building
Number line
Original intervals, newInterval, and the result
intervals is sorted by start and has no overlaps. Insert newInterval so the list stays sorted and overlap-free, merging where needed. Intervals that share a point, like [1,2] and [2,3], overlap.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
Original intervals, newInterval, and the result
n = len(intervals). The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. Up to 8 intervals with values from 0 to 40, written as JSON.