Problem library

Top Players

Medium
sorting

entries is a list of [name, score] pairs with unique names. Return the names of the top k players, ordered by score from highest to lowest. Players with equal scores are ordered alphabetically by name. If there are fewer than k players, return all of them.

Examples

Input: entries = [["ivy",30],["bo",50],["al",30]], k = 2
Output: ["bo","al"]
Input: entries = [["x",1]], k = 3
Output: ["x"]