Position: Merge Two Sorted Interval Lists
Had my intern interview last week:
Two questions were asked:
1. Merged two sorted arrays in one (No need to explain this one)
2. Given two Lists of sorted intervals merge the overlapping items
List[int[]] listA = {[1,3], [4,5], [7,10], [16, 17]};
List[int[]] listB = {[2,3], [4,8], [11,15]};
Expected result:
{[1,3], [4, 10], [11, 15], [16, 17]}
Both solutions I gave were O(n) and both were coded and tested with the interviewer :)
Update:
My recruiter just emailed me, I'm passing to the second and final round interview! Lets hope everything turns good!