ByteByteGo logo
menuProblems List

Merge Overlapping Intervals

Medium

Merge an array of intervals so there are no overlapping intervals, and return the resultant merged intervals.

Example:

Input: intervals = [[3, 4], [7, 8], [2, 5], [6, 7], [1, 4]]
Output: [[1, 5], [6, 8]]

Constraints:

  • The input contains at least one interval.

  • For every index i in the array, intervals[i].start ≤ intervals[i].end.

You can practice coding exercises online by logging into bytebytego.com on your laptop.