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
Intervals (with length) on top, query points below
For each query point q, return the length (right − left + 1) of the shortest interval with left ≤ q ≤ right, or −1 if none contains it. Answers go in the original query order.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
Intervals (with length) on top, query points below
n = number of intervals, m = number of queries. The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. Up to 8 intervals and 8 queries, values from 1 to 40, written as JSON.