Data Structures & AlgorithmsHardProduct company OA · Amazon/Microsoft-style OA

Meetings are the half-open intervals [0,30), [5,10), [15,20), [10,15), [20,25); a room can host a new meeting starting exactly when another one ends. What is the minimum number of rooms needed?

  1. A. 3
  2. B. 5
  3. C. 2
  4. D. 4

Correct answer: C. 2

Sweep over events and process ends before starts at the same time, so a room freed at time 10 is reused at time 10. Processing starts first at a tie claims an extra room; that version gives 3 instead of 2.

More Coding Interview Problems questions

Exams that ask this topic