
Problem Challenge 3: Employee Free Time (hard)
Problem Statement
For K employees, we are given a list of intervals representing each employee's working hours. Our goal is to determine if there is a free interval which is common to all employees.
Example 1:
Input: Employee Working Hours=[[[1,3], [5,6]], [[2,3], [6,8]]]
Output: [3,5]
Explanation: All the employees are free between [3,5].
Example 2:
Input: Employee Working Hours=[[[1,3], [9,12]], [[2,4]], [[6,8]]]
Output: [4,6], [8,9]
Explanation: All employees are free between [4,6] and [8,9].
Example 3:
Input: Employee Working Hours=[[[1,3]], [[2,4]], [[3,5], [7,9]]]
Output: [5,7]
Explanation: All employees are free between [5,7].
Constraints:
1 <= schedule.length , schedule[i].length <= 50- 0 <= schedule[i].start < schedule[i].end <= 10^8
- Each employee's own working hours are sorted by start time and do not overlap each other.
- Free time is measured only between the working intervals, from the earliest start to the latest end across all employees. Time after the last employee stops working is not reported, so the answer never contains an open-ended interval.
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
.....
.....
.....
Unlock this and all other premium problems.
No code editor for this lesson
This lesson focuses on concepts and theory