Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 510 Bytes

File metadata and controls

12 lines (9 loc) · 510 Bytes

Problem 14: Temporal Union (Merge Intervals)

Problem Statement

Given an array of intervals where intervals[i] = [start_i, end_i], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

Input Format

  • A 2D array of intervals.

Example

Input: intervals = [[1, 3], [2, 6], [8, 10], [15, 18]]
Output: [[1, 6], [8, 10], [15, 18]] Explanation: Since intervals [1, 3] and [2, 6] overlap, merge them into [1, 6].