Meeting Rooms Needed
Each meeting is [start, end) — it occupies a room from start up to but not including end, so a meeting ending at 10 and another starting at 10 can share a room.
Given a list of meetings, return the minimum number of rooms needed to hold them all.
Example 1
Input: meetings = [[0, 30], [5, 10], [15, 20]] Output: 2
Example 2
Input: meetings = [[7, 10], [2, 4]] Output: 1
Constraints
- 0 <= meetings.length <= 10^4
- 0 <= start < end <= 10^6
Hint 1
Sort start times and end times separately.
Hint 2
Sweep through starts; free a room for every meeting that ended at or before the current start.
Discussion 0
Join free to post in the discussion.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Game Developer, Automation Test Engineer, Cloud Engineer
Run checks your code on 2 sample tests. Submit runs all 7 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.