AlgoScope

Meeting Rooms

AlgorithmintermediateGreedy

Minimum rooms = maximum number of simultaneous meetings; sweep sorted starts and ends.

Decision · step 2 of 14Intervals and Greedy Choices: How many rooms
012345678910abcdefaaabbbccccdddeeeeffft

t = 0: a starts, taking a room. Open meetings: 1. That is a new maximum, so at least 1 rooms are needed.

Open in the player →or start at step 2

What you will see

A sweep line crosses sorted endpoints; a counter rises on starts and falls on ends.

How intervals and greedy choices works →

Cost

BestO(n log n)
AverageO(n log n)
WorstO(n log n)
SpaceO(n)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.

Screen readers: Candidates announce their key and state (candidate, chosen, rejected); each step announces the local choice and its consequence.

Reduced motion: Chosen and rejected states crossfade; no travelling emphasis.

Related

Leads to

Topics that need this one first.

Taught by the same lesson

Intervals and Greedy Choices covers these too, in the same run.