Skip to main content
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 Prep

Unlock 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 Prep
Unlock with Interview Prep

Reference solution· runs in the browser sandbox

Interview Prep
Unlock with Interview Prep

Common mistakes· 5

Interview Prep
Locked

Best practices· 4

Interview Prep
Locked

Likely follow-ups· 5 questions

Interview Prep
Unlock with Interview Prep

+ 91 more System Design questions in Interview Prep, each with the full answer.

Discussion