← All problems

Merge Intervals

medium

Given an array of intervals [start, end], merge all overlapping intervals and return the non-overlapping intervals that cover all the input ranges. Intervals aren't guaranteed to be sorted.

Example

Input: intervals = [[1, 3], [2, 6], [8, 10], [15, 18]]
Output: [[1, 6], [8, 10], [15, 18]]
Loading...