Skip to content
Preptima
mediumCodingEntryMidSenior

Given a list of meetings with start and end times, tell me the minimum number of rooms needed to hold all of them.

5 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

The minimum room count is the maximum number of meetings running at once, found by sweeping the start and end times in sorted order and tracking a running count. The starts and ends can be sorted independently, and a meeting ending exactly when another begins must free its room or you will overcount.

Was this answer helpful?

Likely follow-ups

  • Now tell me which room each meeting goes in, not just how many rooms.
  • The meetings arrive over time rather than being given up front. What changes?
  • Rooms have capacities and meetings have attendee counts. Is this still the same problem?
  • Report the busiest window, meaning the time span during which the maximum number of rooms is in use.

Related questions