Ctrl K

Medals and Places

Easy
At a figure skating event the judges have posted the final scores: points[i] is the total of the i-th skater. All totals are distinct. Places go by score in descending order: the highest total takes first place, the next one second, and so on. Instead of a place number, the top three receive medals: - 1st place: "Gold Medal"; - 2nd place: "Silver Medal"; - 3rd place: "Bronze Medal"; - 4th place onward: the place number as a string, such as "4". Return an array of the same length whose i-th element is the medal or place of the i-th skater.
Example 1
points=[40, 95, 12, 70] → ['Bronze Medal', 'Gold Medal', '4', 'Silver Medal']

The second skater has the most (95) and gets gold, 70 gets silver, 40 gets bronze, and 12 takes 4th place.

Example 2
points=[3, 8] → ['Silver Medal', 'Gold Medal']

With only two skaters, 8 gets gold and 3 gets silver.

Example 3
points=[1, 2, 3, 4, 5, 6] → ['6', '5', '4', 'Bronze Medal', 'Silver Medal', 'Gold Medal']
Constraints
  • 1 ≤ len(points) ≤ 10⁵
  • 0 ≤ points[i] ≤ 10⁶
  • All values in points are distinct
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsAverage of the Best Five EasyThe Dimmest Rows EasyTwo Picks, Minus One EasyBest Picks in Order EasyThree-Drink Dispenser Easy
loading Python…
Input
points=[40, 95, 12, 70]
Expected
['Bronze Medal', 'Gold Medal', '4', 'Silver Medal']

Run checks the first 3 tests in your browser. Submit checks all 88 tests on the server, hidden ones included.