Problem context and objectives
Mission briefing
Clockwork game engineer · A tournament scoreboard has jammed
Restore the order before the next round begins: Frequency Foundry.
A wrong ordering changes who advances, while a slow repair freezes every active match.
How you win
- 1Recognize when Counting sort matches the clues
- 2Keep this true after every move: each bucket equals the number of times its value appears
- 3Reach the result within O(n + k)
Rules and pressure
- Target cost: O(n + k)
- State rule: each bucket equals the number of times its value appears
Lesson 1 of 3
Each value names the numbered silo it enters. Allocate max value plus one silos.
Your call · The maximum value is 4. How many buckets are needed?