Layer 3 · Go deeper · 11 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How many Submits and Runs a second at the contest peak?
How many judge cores does the contest peak need?
What does it cost to copy a contest’s tests to every judge?
Build-up · 5 steps
Build the high-level design
One functional requirement at a time, ending with a judge that works for one region at modest traffic.
Step 1 of 5
Browse and submit
Statements come from a CDN and the 3,000-problem list from memory, so browsing is cheap. Submit is the only write: check the language, size and contest, store the row and source, return 202.
6 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 6
Interviewer
“Any submission can be a fork bomb, a port scanner or an attempt to read the hidden tests. Where does it run?”
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“A solution needs 0.9 s against a 1 s limit. How do you make sure it gets the same verdict every time?”
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“Sunday 8:00, 80,000 people start a contest and load jumps fourfold in three minutes. How do you keep verdicts fast?”
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“Test data averages 40 MB a problem, and a leak voids a contest. How does it reach the judges?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“A verdict takes a few seconds, and 80,000 contestants are watching. How does the browser find out?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“80,000 contestants read the board 8,000 times a second while rejudges rewrite verdicts. How do you rank them?”
Your move. Pick an approach:
Build-up · 8 steps
Follow one contest submission through it
The submit path is a short write and a queue; everything slow happens on judge hosts; everything users watch is pushed or cached.
Step 1 of 8
Submit
The browser posts the code with an idempotency key. The gateway authenticates the user and applies a per-user rate limit.