I knew the general shape of this problem but the sorted input is actually a gift you have to use properly.
Walk through the intervals in three phases: first, add all intervals that end before the new interval starts; second, merge all intervals that overlap with the new interval; third, add the remaining intervals. This yields a single pass O(n) time and O(n) space solution.
Pro tip: Clarify edge cases upfront (empty list, new interval before all, after all, fully contained) and mention that the output list can be built in-place if mutation is allowed, but since the problem asks for O(n) space, creating a new list is fine.
Restate the problem, confirm input format (list of intervals, each as [start, end]), and ask about edge cases like empty list or intervals that just touch.
Explain that you will iterate through intervals, first adding those that end before the new interval starts, then merging overlapping ones, then adding the rest.
During the merge phase, update the new interval's start to min(current start, new start) and end to max(current end, new end) until no overlap, then add the merged interval.
State that the algorithm runs in O(n) time because each interval is visited once, and O(n) space for the output list.
Walk through a few examples, including edge cases, to verify correctness and demonstrate thoroughness.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.