Ezvor

759. Employee Free Time

HardArray Preparing judge… LeetCode
ArraySweep LineSortingHeap (Priority Queue)

Hints

Hint 1
Take all the intervals and do an "events" (or "line sweep") approach - an event of (x, OPEN) increases the number of active intervals, while (x, CLOSE) decreases it. Processing in sorted order from left to right, if the number of active intervals is zero, then you crossed a region of common free time.