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
73.0%
Submissions
250,771
Accepted
182,947