Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort meetings based on start times.
Use two min heaps, the first one keeps track of the numbers of all the rooms that are free. The second heap keeps track of the end times of all the meetings that are happening and the room that they are in.
Keep track of the number of times each room is used in an array.
With each meeting, check if there are any free rooms. If there are, then use the room with the smallest number. Otherwise, assign the meeting to the room whose meeting will end the soonest.