Uber | Phone Screen | Difference of two lists of intervals

Anonymous User
857
Sep 10, 2019
Sep 10, 2019

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 (2)