Build the Result Array

You have sorted intervals arriving one at a time. For each arrival, you decide: does it extend the last bar, or start a new one?

Build the merged result yourself.

The Merge Pass

Each interval arrives as a ghost. Predict the action before it happens.

Sorted intervals arrive one at a time. 13 commits first — the seed.
[1,3]
0
2
4
6
8
10
12
14
16
18