System Design · Senior · Question 56 of 75
How would you implement a real-time game leaderboard?
- ✓Correct answer: With a sorted set (e.g. Redis ZSET) that keeps scores ordered and returns rank and top N in logarithmic time
- 2By sorting all players in SQL on every request
- 3By sorting in the browser
Explanation
Persist scores in a durable store; the sorted set acts as a fast, rebuildable index.