36. Merge Intervals
Easy
Given half-open intervals in the form [start, end). Merge overlapping intervals and return the resulting list sorted by start. Intervals that only touch at one endpoint do not overlap.
Example 1
Input: intervalos = [[5, 8], [1, 3], [2, 4]]
Output: [[1, 4], [5, 8]]
Example 2
Input: intervalos = [[2, 6], [6, 9]]
Output: [[2, 6], [6, 9]]
Constraints
- 0 <= intervalos.length <= 10^4
- 0 <= início <= fim <= 10^9
IntervalsSorting
Saved in this browser
Caso 1
intervalos =
[[5,8],[1,3],[2,4]]
Expected =
[[1,4],[5,8]]
Caso 2
intervalos =
[[2,6],[6,9]]
Expected =
[[2,6],[6,9]]
Run checks these 2 cases. Submit runs all 6, including hidden ones.