Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

(This question is a variation of the LeetCode question 56. Merge Intervals. If you haven't completed that question yet, it is recommended to solve it first.)

Given two lists of intervals, where each interval is represented as a two-element array [start, end]. Each list contains non-overlapping intervals that are sorted by their start times.

You are asked to merge these two lists into a single list of non-overlapping intervals. If intervals from different lists overlap, they should be combined into a single continuous interval.

Constraints:

  • Both lists are sorted in non-descending order by the start time.
  • There is no overlap within each individual list.
Test Cases
Input
Output
Expected