Rank of Each Score
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
1 <= len(scores) <= 100- All scores are different
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Ranks Without GapsMedium
- Record HighsMedium
- Risk of a MixMedium
- Row SharesMedium
- Sort by First ColumnMedium
- Subtract Row MinimumMedium
- Unit VectorsMedium
- Best Square BlockHard