You are given an integer array
scoreof sizen, wherescore[i]is the score of theithathlete in a competition. All the scores are guaranteed to be unique.The athletes are placed based on their scores, where the
1stplace athlete has the highest score, the2ndplace athlete has the2ndhighest score, and so on. The placement of each athlete determines their rank:
- The
1stplace athlete’s rank is"Gold Medal".- The
2ndplace athlete’s rank is"Silver Medal".- The
3rdplace athlete’s rank is"Bronze Medal".- For the
4thplace to thenthplace athlete, their rank is their placement number (i.e., thexthplace athlete’s rank is"x").Return an array
answerof sizenwhereanswer[i]is the rank of theithathlete.
1 | class Solution { |