Online judge
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    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 judge jobs a second on a normal evening?

      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.

            1. 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:

            2. 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:

            3. 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:

            4. 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:

            5. 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:

            6. 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.