Leetcode 1244. Design A Leaderboard
Design a data structure that supports addScore(playerId, score), reset(playerId), and top(K) which returns the sum of the top K players' scores; the core challenge is maintaining dynamic scores under frequent updates and answering top-K sum queries efficiently (e.g., via an ordered structure or heaps combined with a map).
Asked at:
Yahoo
Uber
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid January, 2026
Yahoo
Junior
Pros/Cons of heap approach– Simple, memory‑efficient; recompute each call (O(n)) if not using persistent heap. More performant alternative– Use SortedList (or balanced BST) + dictionary; updates O(log n), getHighScores O(1). Further optimization– Fixed‑size min‑heap alongside dictionary; lazy deletion; possible Redis Sorted Set for distributed scale.
Early December, 2025
Uber
Mid-level
Hello Interview Premium
Your account is free and you can post anonymously if you choose.