Uber | Phone Screen | Union and Intersection of 2 Interval Lists

2443
Oct 05, 2017
Aug 14, 2019

Given two list of unsorted intervals l1 and l2 write 2 functions

  1. OR (merge)
  2. AND (intersection)

Example:

Input: l1 = [[2, 4], [6, 8], [1, 3]], l2 = [[7, 9], [2, 5]]
Output:
OR => [[1, 5], [6, 9]]
AND => [[2, 4], [7, 8]]
Comments (2)