โ† All coding problems

Merge intervals

HardSorting

Given a list of [start, end] intervals, merge all overlapping ones and return them sorted by start. Touching intervals like [1,2] and [2,3] merge.

Function
function solve(intervals)
Example 1
intervals = [[1,3],[2,6],[8,10],[15,18]]
โ†’ [[1,6],[8,10],[15,18]]

Submit also runs 3 hidden tests, including edge cases.

console.log output is shown below