Interval Problems and Sweep Line: Overlapping Ranges, Merge Intervals, Monotonic Stack and Calendar/Slot Scenarios
Most interval problems are solved in O(n log n) with a half-open [Start, End) definition, sorting by start and a sweep line. We write overlap detection, merge intervals, "how many at most at once" and gap finding in C#, and show how an inclusive last day hides a real campaign overlap, the lowest price of the last 30 days with a monotonic deque, and the same delivery landing on two days because of time zones.
15 Nov 2026
·
11 min
·
5