Relative Ranks
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given an array score where score[i] is the score of the i-th athlete. All scores are **distinct**. Athletes are placed by score: the highest score is 1st place, the next highest is 2nd, and so on.
Return an array answer of the same length where answer[i] is athlete i's rank label: "Gold Medal" for 1st place, "Silver Medal" for 2nd, "Bronze Medal" for 3rd, and the placement number as a string (e.g. "4") for everyone else.
Examples
Constraints
- 1 <= score.length <= 10^4
- 0 <= score[i] <= 10^6
- All values in `score` are distinct
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.