Approach hintTry it first, then revealHide
Sort by start. Keep the last merged interval and extend its end while the next interval starts no later than that end; otherwise begin a new interval. O(n log n).
Sort by start. Keep the last merged interval and extend its end while the next interval starts no later than that end; otherwise begin a new interval. O(n log n).