mediumIntervalsFacebookGoogleMicrosoft
Minimum Rooms Required
A conference organizer finds the minimum number of rooms to host all meetings without conflicts.
Given meeting intervals, return the minimum number of conference rooms required.
Choose approach
1/4
Narrationstep 1 of 4
Start 0 vs End 10. rooms=1, max=1.
Variables
i=0
startAt=0
rooms=1
max=1
How to think about it
- Peak concurrent intervals = answer.
- Equivalent to a chronological event sweep.
Edge cases to catch in interview
- Empty -> 0.
- All overlap -> n rooms.
Examples
Example 1
1{"intervals":[[7,10],[2,4]]}
Try your own input
SpacePlay / pause
← / →Previous / next step
RReset to start
. or >Cycle speed