Data Structures & AlgorithmsHardTCS NQT · Infosys

Meetings (start, end) are [(0, 30), (5, 10), (15, 20), (25, 40), (35, 50), (45, 60), (50, 55)]. A room can host one meeting at a time, and a meeting ending at time t frees the room for one starting at time t. What is the minimum number of rooms needed?

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

Correct answer: B. 2

Sweep over the sorted start and end events: +1 at a start, −1 at an end, processing ends first at equal times; the peak count is the answer. Counting intervals, or the peak minus one, misses how many meetings truly overlap at once.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic