Search⌘ K
AI Features

Solution: Employee Free Time

Explore the process of identifying free time intervals from multiple employee schedules. Understand how to merge overlapping intervals using a min-heap, detect gaps representing free time, and implement an efficient algorithm with clear time and space complexity. This lesson helps develop problem-solving skills essential for coding interviews involving interval manipulation.

Statement

You’re given a list containing the schedules of multiple employees. Each person’s schedule is a list of non-overlapping intervals in a sorted order. An interval is specified with the start and end time, both being positive integers. Your task is to find the list of finite intervals representing the free time for all the employees.

Note: The common free intervals are calculated between the earliest start time and the latest end time of all meetings across all employees.

Constraints:

  • 11 \leq schedule.Length , schedule[i].Length 50\leq 50

  • 00 \leq interval.start < interval.end 108\leq 10^8 ...