Lesson 14 of 15
35. Design a Leaderboard (Top-K)

Sources

3 min read+10 XP

Source notes

  • Redis sorted set commands and their time complexities (ZADD O(log N), ZREVRANK O(log N), ZREVRANGE O(log N + M), ZCOUNT O(log N)): Redis command documentation.
  • Double-precision floats represent integers exactly up to 2⁵³: IEEE 754.
  • Contest sizes, pick rates, shard throughput and refresh rates are interview assumptions agreed in Step 1, not figures for any real app. Arithmetic computed 2026-10-08.
  • Sorted-set behaviour, fan-out share, composite tie scores, competition ranking, sharded top-K and rank, and histogram percentiles: tested 2026-10-08 (code/ch35_leaderboard.py, all checks pass).