Description
Given scores of athletes in a competition, return an array of their relative ranks. The top three receive "Gold Medal", "Silver Medal", and "Bronze Medal".
Examples
Input:
score = [5,4,3,2,1]Output:
["Gold Medal","Silver Medal","Bronze Medal","4","5"]Explanation:
Ranks assigned.
Input:
[100]Output:
["Gold Medal"]Explanation:
With only one score, that athlete gets the Gold Medal since they rank 1st (highest score).
Input:
[7, 12, 6, 15]Output:
["Bronze Medal", "Silver Medal", "4", "Gold Medal"]Explanation:
Sorted scores: 15(1st), 12(2nd), 7(3rd), 6(4th). So score 7 gets Bronze Medal, 12 gets Silver Medal, 6 gets rank "4", and 15 gets Gold Medal.
Constraints
- •
1 ≤ n ≤ 10⁴