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 on 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 1,2, 2 and 3, respectively. If the player's scores are70 ,80 and 105, their rankings after each game are 4th, 3rd and1st. Return [4,3,1]
Function Description
int ranked[n]: the leaderboard scores
int player[m]: the player's scores
Returns
int[m]: the player's rank after each new score
Input Format
Length of ranked Array
Ranked Array
Length of Player Array
Player Array
Input 1
7
100 100 50 40 40 20 10
4
5 25 50 120
Input 2
6
100 90 90 80 75 60
5
50 65 77 90 102
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 on 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 1,2, 2 and 3, respectively. If the player's scores are70 ,80 and 105, their rankings after each game are 4th, 3rd and1st. Return [4,3,1] Function Description int ranked[n]: the leaderboard scores int player[m]: the player's scores Returns int[m]: the player's rank after each new score Input Format Length of ranked Array Ranked Array Length of Player Array Player Array Input 1 7 100 100 50 40 40 20 10 4 5 25 50 120 Input 2 6 100 90 90 80 75 60 5 50 65 77 90 102