Rank players by points
A basketball league stores one player per row as "name,points", where points is a non-negative integer and names are distinct. Return the rows reordered for the standings page: highest points first, and when two players are tied on points, alphabetical by name. Example: ["kim,30", "ali,42", "joe,30"] gives ["ali,42", "joe,30", "kim,30"].
Implement
rank_players(rows: list[str]) → list[str]Examples
in
[["kim,30","ali,42","joe,30"]]out["ali,42","joe,30","kim,30"]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 14 min
solution.py
InputExpectedGot
[["kim,30","ali,42","joe,30"]]["ali,42","joe,30","kim,30"]not run yetsample