Uber | Phone Screen | Difference of two lists of intervals

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2019-09-10Added By Anonymous
Source: Link

Company: Uber
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Given two lists of closed intervals, each list of intervals is pairwise disjoint and in sorted order. Find the symmetric difference (non-overlapping intervals) between the two lists.

Example 1:
Input: a = [[1, 5], [7, 10], [12,14]], b = [[2, 6], [10, 10]]
Output: [[1, 1], [6, 6], [7, 9], [12, 14]]

Very similar to https://leetcode.com/problems/interval-list-intersections/ but with the difference

Comments