Competition Ranking
ARRAY

Problem

Given an array of integers scores where scores[i] is the score of the ith athlete, return an array answer where answer[i] is the rank of the ith athlete.

The rank is a string that represents the athlete's position in the competition:

  • The athlete with the highest score gets "Gold Board".
  • The athlete with the second highest score gets "Silver Board".
  • The athlete with the third highest score gets "Bronze Board".
  • For the rest of the athletes, their rank is their position in the scores array, converted to a string, starting from 1.

Examples

makeRanks([50, 60, 40, 30, 20]) // returns ["Silver Board", "Gold Board", "Bronze Board", "4", "5"] // The surf bots are ranked as [2nd, 1st, 3rd, 4th, 5th]. makeRanks([15, 25, 10, 20, 5]) // returns ["Bronze Board", "Gold Board", "4", "Silver Board", "5"] // The surf bots are ranked as [3rd, 1st, 4th, 2nd, 5th].
Loading...