Design a Gaming Leaderboard
Design a real-time leaderboard for a mobile game with 50M daily players: show the global top 100, a player's own rank, and players ranked near them, updated within seconds of each match. Seasons reset monthly.
How the interview goes
Five phases, and questions the interviewer is likely to ask in each.
1. Requirements
- Does rank 4,500,123 need to be exact?
- Who is allowed to submit scores?
Show a hintHint
Ask whether exact rank matters for players far from the top.
2. High-level design
- What is the source of truth, and what is derived?
- How fast must a new score show?
Show a hintHint
Keep a durable record and a fast ranking structure, and know which is which.
3. Deep dive
- How do you compute a player's rank in a sorted set?
- How do you handle ties?
Show a hintHint
A sorted set answers 'rank of member' in logarithmic time.
4. Scaling
- How would you split the board across machines?
- What if the in-memory store is lost?
Show a hintHint
Splitting by score range keeps rank lookups local.
5. Trade-offs
- Exact versus approximate rank for the long tail?
- Friends leaderboards: compute on read or write?
Show a hintHint
Approximate ranks with buckets can be far cheaper.
Practice this with an AI interviewer
Write your design doc with live diagrams while the interviewer asks one question at a time and pushes on your choices. Get a scored debrief with what to study next.
Start this interview