Intermediatecoding Verified ~15 min
Class design: build a leaderboard that supports adding users (name, email, score starting at zero), updating scores and returning the top K users.
ReportedSource: GeeksforGeeks interview experience: Uber SDE-1 off-campus 2021
Quick answerFree
Keep a dict of users and a max-heap of (-score, order, id) entries with lazy deletion: an update pushes a new entry and stale ones are skipped on read. Update is O(log n), top-K is O(k log n). Generate ids internally, enforce unique email, and break ties by who reached the score first.
Detailed answer· ~240 words
Interview PrepUnlock the full answer with Interview Prep
Get a ~240-word model answer, 5 key points, a runnable reference solution, 5 common mistakes and 5 follow-ups, plus 91 more System Design questions.
Also in Pro (₹499 / 90 days).
Key points· 5 points
Interview PrepUnlock with Interview Prep
Reference solution· runs in the browser sandbox
Interview PrepUnlock with Interview Prep
Common mistakes· 5
Interview PrepLocked
Best practices· 4
Interview PrepLocked
Likely follow-ups· 5 questions
Interview PrepUnlock with Interview Prep
+ 91 more System Design questions in Interview Prep, each with the full answer.