We are given a list schedule of employees, which represents the working time for each employee. Each employee has a list of non-overlapping Intervals, and these intervals are in sorted order. Return the list of finite intervals representing common, positive-length free time for all employees, also in sorted order.
Example 1
Input: schedule = [[[1,2],[5,6]],[[1,3]],[[4,10]]]
Output: [[3,4]]
Explanation: Merging everyone's working hours gives [1,3] (from [1,2] and [1,3]) and [4,10] (which covers [5,6]). The only gap when nobody is working is [3,4].
Example 2
Input: schedule = [[[1,3],[6,7]],[[2,4]],[[2,5],[9,12]]]
Output: [[5,6],[7,9]]
Explanation: Working hours [1,3], [2,4] and [2,5] merge into [1,5]. Then [6,7] and [9,12] follow. The gaps between these blocks are [5,6] and [7,9].
Example 3
Input: schedule = [[[1,2]],[[3,4]]]
Output: [[2,3]]
Explanation: One employee works [1,2] and the other works [3,4]. Both are free between 2 and 3.
Flatten all intervals into one list, sort by start, merge overlapping ones, then gaps between merged intervals are the free time.
Run checks all cases above. Submit evaluates all test cases.