Implement the three-phase algorithm. The goal is tracking which intervals overlap with the new one.
Two intervals overlap if one starts before the other ends AND ends after the other starts.
In phase 2, you expand the new interval to encompass all overlapping intervals, then add the expanded interval once. Time: single pass. Space: for output. Test cases: - New interval at start - New interval at end - New interval merges everything - New interval merges nothing