I have a feeling this might allow for more optimization? For instance I think it's the bottleneck in @johannh's example where none of the series overlap. Could we perhaps use a priority queue that stores the next smallest key, and the series it came from? Then we could avoid looping from 0 to current.Length (2 times), which in @johannh's case is 2000 + 2000 for each key ...