An office booking system must give every meeting a room. Meeting i runs over [start, end], using its room from start up to end. A room freed at time t can host a meeting starting at time t.
Write roomsNeeded(meetings) that returns the smallest number of rooms that can host all the meetings.
Input: meetings = [[0,40],[10,15],[20,25]] Output: 2
The long meeting needs its own room; the two short ones share another.
Input: meetings = [[7,10],[2,4]] Output: 1
They don't overlap.
0 <= meetings.length <= 1000000 <= start < end <= 10^6Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #587 Rooms Needed for Every Meeting. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.