Top Earners per Department
staff has columns name, dept and salary. For each department, find everyone who earns the highest salary in that department (several people can tie). Return a dictionary mapping each department to the alphabetically sorted list of those names.
Example 1
staff {"name":["ann","bo","cy"],"dept":["it","it","hr"],"salary":[90,90,50]}
returns {"hr":["cy"],"it":["ann","bo"]}
Ann and Bo tie in it.
Constraints
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.