1244. Design A Leaderboard

Problem

Design a leaderboard with addScore, top (sum of top K scores), and reset operations.

Design a Leaderboard class that supports:

  • addScore(playerId, score): Update the score for a player by adding score to their existing score (or create new entry with score if player doesn't exist).
  • top(k): Return the sum of the top k scores across all players.
  • reset(playerId): Reset the score of the specified player to 0.
Examples
Input: [["Leaderboard","addScore","addScore","addScore","addScore","addScore","top","reset","reset","addScore","top"],[[],[1,73],[2,56],[3,39],[4,51],[5,4],[1],[1],[2],[2,51],[3]]]
Output: [null,null,null,null,null,null,73,null,null,null,141]
Hints
Related Problems

1244. Design A Leaderboard

Design a leaderboard with addScore, top (sum of top K scores), and reset operations.