Climbing the Leaderboard
An arcade game player wants to climb to the top of the leaderboard and track their ranking. The game uses Dense Ranking , so its leaderboard works like this:
- The player with the highest score is ranked number
1on the leaderboard.
- Players who have equal scores receive the same ranking number, and the next player(s) receive the immediately following ranking number.
ranked = [100, 90, 90, 80] player = [70, 80, 105]
The ranked players will have ranks
3, respectively. If the player’s scores are
105, their rankings after each game are
[4, 3, 1].
Complete the climbingLeaderboard function in the editor below.
climbingLeaderboard has the following parameter(s):
- int ranked[n]: the leaderboard scores
- int player[m]: the player’s scores
- int[m]: the player’s rank after each new score
Read more on the challenge page…
I’m providing the solution for Python and JS, please leave on the comments if you found a better way.