ProblemWeb apps and media
Coding practice platform
Solve programming problems, run code against hidden tests and get a result in seconds, even during contests.
The brief
Practice and contests · suggested for Senior
Design a coding practice and contest platform
Design an online judge where people practise coding problems and join timed contests: code in five languages runs against hidden tests, results come back in seconds, and a contest’s first-minute rush neither breaks the platform nor lets anyone’s code harm it or see the tests.
You run a coding practice site. About 2 million people a day browse about 3,000 problems, press Run to try their code on the examples or their own input, and press Submit to have it judged against the hidden tests. Every Saturday a global contest opens four new problems to about 100,000 people at once, with a live ranking. The code people send is written by strangers: some of it is buggy, some slow, and some deliberately hostile. The hidden tests are what make verdicts and rankings fair, so they must stay secret. Contests rank by problems solved, then by total time: the minutes from the start to each problem’s first accept, plus 5 minutes for each wrong submission before it; equal scores go to whoever reached them first. The public ranking may freeze for the last 30 minutes. Design the platform, from a user pressing Submit to their verdict and their place in the ranking.
Functional requirements
- CoreUsers browse problems and read statements, examples and editorials.
- CoreUsers run their code on the examples or their own input, and submit it to be judged against the hidden tests, in one of five languages.
- CoreUsers see each submission’s progress and verdict, and their past submissions.
- CoreContests open new problems to registered users for a fixed window, with a live ranking.
Non-functional requirements
- SecuritySubmitted code cannot reach the internet, the platform’s machines, other users’ data or the hidden tests.
- DurabilityEvery submission the platform receives gets a verdict; none is lost.
- LatencyRun results within 5 s at p95; verdicts within 30 s at p95, and within 90 s at a contest’s peak.
- ConsistencyThe same code gets the same verdict, whenever it runs.
- ConsistencyThe contest ranking is live within about 5 s and correct once the contest ends.
- AvailabilityBrowsing and submitting are available 99.95% of the time.
Scale
- ScaleAbout 2 million users a day and about 3,000 problems.
- ScaleAbout 500,000 submissions and 1.5 million runs a day on a normal day.
- ScaleA weekly contest of about 100,000 people, peaking at about 1,000 submissions a second in its first 10 minutes.
- ScaleAbout 50 hidden tests per problem, 1 to 2 seconds per test; a typical accepted submission uses about 2 seconds of processor time.
Nice to mention (below the line)
- Below the lineDiscussion forums and comments.
- Below the lineHints and AI help while solving.
- Below the lineA live interview mode with a partner.
Out of scope
- Out of scopeProblem authoring tools.
- Out of scopePayments and subscriptions.
- Out of scopeMobile apps.
The variant
One fully specified brief, with the level it suits best. You can practise it at any level.
- Practice and contestsSuggested for Senior
People practise coding problems and join a weekly contest: strangers’ code runs safely against hidden tests, every submission gets a verdict, and rushes and cheats don’t spoil results.
9 steps · 7 must-pass · about 49 min at Senior
What each level is graded on
Practice and contests, step by step. A result at a level needs its must-pass steps answered, and only the steps you answer count. Going up a level adds steps or holds them to a stricter bar.
| Step | Entry level | Mid-level | Your levelSenior | Staff |
|---|---|---|---|---|
| The numbers that shape the design (optional) | Graded | Graded | Graded | Graded |
| Problems, tests, submissions and verdicts | Graded | Graded | Graded | Graded |
| What the site and the judges call | Graded | Must-pass | Must-pass | Must-pass |
| A submission, end to end | Must-pass | Must-pass | Must-pass | Must-pass |
| Running a stranger’s code | Must-passcan block | Must-passcan block | Must-passcan block | Must-passcan block |
| Keeping hidden tests hidden | Must-pass | Must-pass | Must-pass | Must-pass |
| The first minutes of a contest | — | Must-pass | Must-pass | Must-pass |
| The live leaderboard | — | Must-pass | Must-pass | Must-pass |
| Cheaters and abusers | — | — | Must-pass | Must-pass |
| More regions, a bigger bill, a new compiler | — | — | — | Must-pass |
| At this level | 6 steps 3 must-pass about 31 min | 8 steps 6 must-pass about 44 min | 9 steps 7 must-pass about 49 min | 10 steps 8 must-pass about 56 min |
Entry level6 steps · 3 must-pass · about 31 min
- The numbers that shape the design (optional)Graded
- Problems, tests, submissions and verdictsGraded
- What the site and the judges callGraded
- A submission, end to endMust-pass
- Running a stranger’s codeMust-passcan block
- Keeping hidden tests hiddenMust-pass
Mid-level8 steps · 6 must-pass · about 44 min
- The numbers that shape the design (optional)Graded
- Problems, tests, submissions and verdictsGraded
- What the site and the judges callMust-pass
- A submission, end to endMust-pass
- Running a stranger’s codeMust-passcan block
- Keeping hidden tests hiddenMust-pass
- The first minutes of a contestMust-pass
- The live leaderboardMust-pass
SeniorYour level9 steps · 7 must-pass · about 49 min
- The numbers that shape the design (optional)Graded
- Problems, tests, submissions and verdictsGraded
- What the site and the judges callMust-pass
- A submission, end to endMust-pass
- Running a stranger’s codeMust-passcan block
- Keeping hidden tests hiddenMust-pass
- The first minutes of a contestMust-pass
- The live leaderboardMust-pass
- Cheaters and abusersMust-pass
Staff10 steps · 8 must-pass · about 56 min
- The numbers that shape the design (optional)Graded
- Problems, tests, submissions and verdictsGraded
- What the site and the judges callMust-pass
- A submission, end to endMust-pass
- Running a stranger’s codeMust-passcan block
- Keeping hidden tests hiddenMust-pass
- The first minutes of a contestMust-pass
- The live leaderboardMust-pass
- Cheaters and abusersMust-pass
- More regions, a bigger bill, a new compilerMust-pass
- Must-pass
- a result at that level needs this step answered.
- Can block
- a miss there is a Blocking issue at that level.
Going up a level
- Mid-level
- “What the site and the judges call” becomes must-pass.“Keeping hidden tests hidden” is graded more strictly.Adds “The first minutes of a contest”, must-pass.Adds “The live leaderboard”, must-pass.
- Senior
- “Running a stranger’s code” is graded more strictly.“The first minutes of a contest” is graded more strictly.Adds “Cheaters and abusers”, must-pass.
- Staff
- “The live leaderboard” is graded more strictly.“Cheaters and abusers” is graded more strictly.Adds “More regions, a bigger bill, a new compiler”, must-pass.
Skills this problem practises
Your coach tracks readiness per skill across every problem you practise. Each links to the lesson that teaches it.
- Capacity estimation
- API design
- Idempotency and retries
- Data modelling
- Choosing storage
- Queues and async messaging
- Load balancing
- Traffic surges and backpressure
- Consistency and concurrency
- Failure modes and recovery
- Latency budgets
- Rate limiting and abuse
- Security and privacy
Worked solution
Try it first: practise a variant, then read the walkthrough and compare it with your own design. Reading it first makes the practice much less useful.
Learn: Design LeetCodeYour history
Sign in to see your sessions on this problem.