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

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2017-10-05Added By Anonymous
Source: Link

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

Original Post Content:

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