35. Design a Leaderboard (Top-K)
The interview prompt
This chapter is a full interview round, played out step by step. The interviewer's lines are in quotes. At each step you'll see what a strong candidate says, the pushback the interviewer throws, and how to answer it. At the end, grade yourself with the rubric.
How to use this chapter
- Read only the prompt below. Then stop.
- Set a 45-minute timer and do the whole round yourself, on paper or a whiteboard, out loud. Use the framework from Chapter 1: READ, then Draw, Dive, Defend.
- Then read the walkthrough and compare. Score yourself with the rubric at the end.
The running example is a fantasy cricket contest during a big T20 final: users build teams of 11 real players before the match, and earn points as those players score runs and take wickets. The twist that makes it hard: one ball in the real match changes millions of users' scores at once.
The prompt
"Design the live leaderboard for a fantasy cricket contest. Millions of users join; during the match, everyone wants to see the top players and their own rank, updating as the match goes on."
Stop here. Start your timer.