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

Meetings (start, end) are (1,2), (3,4), (0,6), (5,7), (8,9), (5,9). A room hosts one meeting at a time, and a meeting may start exactly when the previous one ends. What is the maximum number of meetings in one room?

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

Correct answer: C. 4

Activity selection: sort by end time and take each meeting that starts at or after the last chosen end. Sorting by start time picks the long meeting (0, 6) first and loses two meetings.

More Coding Interview Problems questions

Exams that ask this topic