761. Employee Free Time

Hard
Array
Sweep Line
Sorting
Heap (Priority Queue)

Description

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.

Statistics

Acceptance
72.8%
Submissions
242,854
Accepted
176,713