Intervals & Sweep Lines Hard
Drone Contest Profile
Merge time intervals into one altitude profile showing the highest drone in the air at each moment.
Trace input
Bounded JSONEdit the lesson input, then build a deterministic source-linked trace.
Source scenarios
Complexity
BestO(N log N)
AverageO(N log N)
WorstO(N log N)
SpaceO(N log N) trace · O(N) profile
Array state
Follow the active comparisons and writes.
Current operation
Trace stateReady to explore
Source behavior & common mistakes
A reservation is active during [start, end). Return sorted time-height changes, beginning at (0, 0), ending when the last drone lands, and never repeat the same height twice in a row.
- Treating landing time as inclusive; the source uses [start, end).
- Taking the right half's height without comparing it with the left half.
- Emitting two profile changes when both halves change at the same time.
Algorithm code
JavaDroneContest.javaStep linked
The highlighted line follows the current step.
Ready to begin
Press Play to see what happens.
Detailed execution
Snapshot 1 / 1
Comparisons 0 · Writes 0