FunctionRacerProblemsRace

Rank of Each Score

MediumNumPyPython

Return an array where item i is the rank of scores[i]: 0 for the smallest score, 1 for the next smallest, and so on. All scores are different. Hint: np.argsort applied twice.

Example 1

scores [30,10,20]
returns [2,0,1]

10 is the smallest (rank 0), 20 is rank 1, 30 is rank 2.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems