Two Best per Team
players has columns name, team and score. For each team, take the two players with the highest scores (or just one if the team has only one player). Ties in score are broken by name, alphabetically. Return a dictionary mapping each team to the list of those names, best first.
Example 1
players {"name":["a","b","c","d"],"team":["x","x","x","y"],"score":[5,9,7,1]}
returns {"x":["b","c"],"y":["d"]}
x: b (9), c (7). y: d.
Constraints
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.