Problem. intervals is sorted by start and has no overlaps. Insert new so the list stays sorted and disjoint, merging any
intervals it overlaps (touching counts as overlapping).
intervals = [[1, 3], [6, 9]], new = [2, 5] → [[1, 5], [6, 9]]
intervals = [[1, 2], [3, 5], [6, 7], [8, 10], [12, 16]], new = [4, 8] → [[1, 2], [3, 10], [12, 16]]
Lesson 14.2 merged an unsorted list. Here the list is already sorted and clean, and only one interval is new. Re-sorting throws that information away. Instead, the new interval splits the list into three contiguous parts: intervals entirely before it, a block that overlaps it, and intervals entirely after it.
ML context. A shared GPU cluster keeps, for each machine, the sorted list of reserved time ranges. Booking a job inserts an interval; asking "when is the next free 2-hour window?" scans the gaps between reservations (Change D). The same structure tracks which byte ranges of a dataset have been downloaded, or which spans of a document have been annotated.