Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Fair Multiplayer Typing Race

Design a real-time typing race with language-based matchmaking, authoritative progress and visible errors, read-only spectators, wrong-letter freezes, latency-aware winner selection, and durable rankings.

Problem statement

For this exercise, assume authenticated players choose a language and enter matchmaking for a two-to-eight-player typing race in that language. All racers in a match receive the same immutable passage in the selected language and a server-scheduled start time.

Players submit ordered typing input, see each participant's confirmed progress and typing errors in real time, and may reconnect briefly to the same active session.

Authenticated spectators can join a race as read-only viewers of the same passage, progress, errors, freeze state, and final result; they do not occupy racer slots or submit race input. A correct next character advances authoritative progress.

A wrong character freezes that player for exactly one second according to the server's monotonic clock; input received for the frozen interval cannot advance the passage, and an explicit unfreeze transition resumes play. The first player whose complete passage is authoritatively verified wins.

The system must mitigate unequal network latency when placing a match and deciding a close finish, but it must not trust arbitrary client timestamps or allow a declared winner to change later.

One immutable match result records placement, elapsed time, and error count, then drives one idempotent score or rating update under a replaceable policy. Passage-authoring tools, anti-cheat beyond transport integrity and plausibility checks, chat, tournaments, prizes, and social features are outside scope.

What to build

  1. Players choose a language, can join or cancel one active queue entry, and two through eight compatible players choosing that language receive one match, the same immutable passage version in that language, an authenticated route, and a scheduled start.
  2. The active session accepts ordered typing input, advances only the verified next character, and enforces a one-second server-authoritative freeze after every wrong character.
  3. Players and read-only spectators receive versioned confirmed progress, visible typing errors, and freeze state. Players can reconnect within a short grace period without creating another session authority; spectators can join an active race from its current snapshot without affecting racer slots or input processing.
  4. The system mitigates unequal network latency, declares one immutable first finisher, records every placement, and applies each match's score or rating effect exactly once.

At scale

  • For this exercise, assume 200,000 concurrently connected players across three active regions and peaks of 5,000 matchmaking joins per second, with two through eight players per match. Also support 100,000 concurrent read-only spectators overall, with admission capped at 1,000 spectators per race.
  • For this exercise, assume an active player may type up to 20 characters per second; target 100 milliseconds p95 from input receipt to authoritative acknowledgement in a healthy assigned region and publish confirmed progress, error indicators, and freeze state to healthy participant and spectator connections at least five times per second. Slow viewers may receive coalesced updates or a fresh snapshot and must not delay race input.
  • For this exercise, target a scheduled-start skew below 50 milliseconds among healthy connected players and require the fairness policy to use only server-observed timing and capped recent network measurements.
  • For this exercise, retain immutable match results and rating receipts for one year, make a completed result visible in rankings within five seconds, and allow a disconnected player ten seconds to rejoin the same live authority.