Draft
Design a Leaderboard
7 of 9sergiodxa
Description:
Design a Leaderboard
class with 3 functions:
addScore(playerId, score)
: When given an existing player, it increments their score, otherwise, it adds the player to the leaderboard with the given score.top(k)
: Returns the sum of the scores of the topk
players.reset(playerId)
: Resets the score of the player with the given id to 0.
Note that initially, the leaderboard is empty.
Handle invalid cases for each function. E.g. Attempting to reset the score of a player who is not on the leaderboard.
Similar Kata:
Stats:
Created | Aug 4, 2020 |
Warriors Trained | 46 |
Total Skips | 0 |
Total Code Submissions | 105 |
Total Times Completed | 9 |
Ruby Completions | 7 |
JavaScript Completions | 5 |
Total Stars | 0 |
% of votes with a positive feedback rating | 38% of 8 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |