Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort the intervals.
Merge all the mergeable intervals.
For each interval, binary search the latest interval that it can be merged with by adding exactly one interval.