Microsoft VO Coding Interview Question: Minimum Meeting Rooms

18 Views
No Comments

Given a list of meetings, where a meeting has a start and an end time, determine the minimum number of rooms required to schedule all the meetings without any conflicts. A person can also attend a meeting if its starting time is the same as the previous meeting’s ending time.

Input: meetings = [[5, 10], [2, 3]]

Output: 1

Input: meetings = [[1, 3], [5, 7], [4, 6], [7, 9], [9, 10]]

Output: 2

Constraints:

  • 1 <= meetings.length <= 10,000
  • 0 <= start <= 10,000
  • 0 <= end <= 10,000

This problem asks for the minimum number of rooms needed to schedule all meetings without overlap, allowing a meeting to start exactly when another one ends. A standard solution is to sort meetings by start time and use a min-heap to track the earliest ending room currently in use. If the next meeting starts at or after the earliest end time, that room can be reused; otherwise, a new room is required. The answer is the maximum number of simultaneous meetings, which can be computed efficiently with sorting and a priority queue.

END
 0