Merged Timeline — Solution & Editorial
Sort by start; extend the current block while the next interval starts within it (touching counts), else emit and restart.
Complexity: O(N log N)
Sort by start; extend the current block while the next interval starts within it (touching counts), else emit and restart.
Complexity: O(N log N)