Possible Interview Question: How to Find All Overlapping Intervals
Throw the endpoints of the intervals into an array, marking them as either start- or end-points. Sort them by breaking ties by placing end-points before start-points if the intervals are closed, or the other way around if they’re half-open. 1S, 2S, 3E, 4E, 5S, 10E, 12S, 13S, 14E, 15E Then iterate through the list, keeping … Read more