Merge Intervals
Merge overlapping ranges by sorting them by start and extending the last merged range while they overlap.
01The problem
Given intervals [start, end], merge all that overlap and return the result.
| Input | Output |
|---|---|
[[1,3],[2,6],[8,10],[15,18]] | [[1,6],[8,10],[15,18]] |
[[1,4],[4,5]] | [[1,5]] (touching counts) |
Loading the rest of the lesson…