Given two lists of time intervals, find all the overlapping time periods between them. This problem tests your ability to work with interval data structures and algorithmic thinking.
You are given two lists of closed time intervals, schedule1 and schedule2. Each list is sorted in ascending order by the start time of the intervals, and within each list, no intervals overlap. Your task is to find all intervals where the time ranges in schedule1 and schedule2 overlap. Return a list of these overlapping intervals.
The brute-force approach would be like checking every meeting in one schedule against every meeting in the other schedule to see if they collide. For each pair of intervals across the two schedules, you'd compare their start and end times to see if they overlap, and if so, record the overlapping segment. This involves comparing each interval in the first list with every interval in the second list.
Work through this problem with AI coaching and get real-time feedback
Practice This Problem