← ALL NOTES
Array

56. Merge Intervals

Sort the intervals by start, and every pair that overlaps becomes adjacent — which is the whole game. Sweep through: a new interval either extends the last one in your result (if its start isn't past…

Loading…