Skip to content
Preptima
mediumCodingEntryMidSenior

Given a list of meetings with start and end times, pick the largest set of them that do not overlap.

Sort by finishing time and take every meeting that starts no earlier than the last one you took. Earliest start and shortest duration both look reasonable and both give provably smaller answers, and the exchange argument for earliest finish is what the question is really asking for.

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

Answer

Short answer

Sort by finishing time and take every meeting that starts no earlier than the last one you took. Earliest start and shortest duration both look reasonable and both can produce smaller answers; earliest finish is safe because an exchange argument can swap it into an optimal schedule without reducing the count.

Was this answer helpful?

Likely follow-ups

  • Each meeting now carries a value and you want the greatest total value. Does the greedy survive?
  • You have k rooms rather than one. What is the largest set you can hold now?
  • Return which meetings you selected, not just how many.
  • The meetings arrive one at a time and you must accept or reject immediately. How much worse can you do?

Related questions

Related Topics