Employee Free Time
Each employee has a list of non-overlapping, sorted working Intervals. Return the list of finite intervals of positive length that are common free time for ALL employees, sorted in order. Do not include the unbounded time before everyone starts or after everyone ends.
Open official problem prompt ↗Find every finite stretch of time during which no employee anywhere is working.
Overlay everyone's calendars onto one shared calendar and shade in every busy block. The clear stripes between shaded blocks are the moments the whole company is simultaneously free.
- Input
- schedule = [[[1,2],[5,6]], [[1,3]], [[4,10]]]
- Output
- [[3, 4]]
- Why
- Merging all busy intervals gives [1,3] and [4,10]; the only gap between them is [3,4], when everyone is free.
1 <= schedule.length, schedule[i].length <= 500 <= Interval.start < Interval.end <= 10^8Intervals within each employee are disjoint and sorted