FunctionRacerProblemsRace

Ranks With Shared Places

EasySciPyPython

Return the rank of each value, where the smallest value has rank 1. Equal values share the average of the ranks they cover: in [10, 20, 20] the two 20s cover ranks 2 and 3, so each gets 2.5.

Example 1

values [10,20,20]
returns [1.0,2.5,2.5]

10 is rank 1. The two 20s share ranks 2 and 3.

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 SciPy problems