Order by Score
names[i] scored scores[i]. Return the list of names sorted by score from highest to lowest. When two people have the same score, the one who comes earlier in names goes first.
Example 1
names ["Ana","Ben","Cy"]
scores [70,90,70]
returns ["Ben","Ana","Cy"]
Ben is first; Ana and Cy tie, and Ana comes earlier.
Constraints
1 <= len(names) = len(scores) <= 50
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Pairs Hitting TargetMedium
- Pairwise SumsMedium
- Path LengthMedium
- Rank of Each ScoreMedium
- Ranks Without GapsMedium
- Record HighsMedium
- Risk of a MixMedium
- Row SharesMedium