As reported: D. E. Shaw, asked twice. New grad screening (2025): a dashboard for a Codeforces-like platform showing the top 10 programmers by problems solved; updates arrive as a stream
{username: number_of_problems_solved}and at any instant the dashboard shows the current top 10 (implementation in about 25 minutes; the interviewer first suggested a min-heap). Senior Futures-team round (2026): design a game leaderboard — users sign in, play, get a score, can delete their account — showing only the top 10 by score.
Implement a class Leaderboard:
update(user, score)—user's current score becomesscore(a new user is added).remove(user)— the user deletes their account; ignore unknown users.top10()— return the usernames of the (up to) 10 highest scores, highest first.
Example
ops = ["Leaderboard","update","update","update","top10","update","remove","top10"]
args = [[],["ann",5],["bob",9],["cid",5],[],["ann",12],["bob"],[]]
Output: [null,null,null,null,["bob","ann","cid"],null,null,["ann","cid"]]
Constraints: up to 2 · 10^5 calls in total; usernames are 1–20 lowercase letters; 0 ≤ score ≤ 10^9.
Code runner format: one JSON value per line: ops, then args, as on LeetCode. The output lists each call's return value (null for update, remove and the constructor).
Clarifications
- An update replaces the previous score; it can go up or down.
- Ties are ordered by username, alphabetically.
top10()returns fewer names when fewer than 10 users exist.