Problem library

Round Robin Table

Medium
hash mapsorting

Each entry in matches is [playerA, playerB, winner], where winner is one of the two players. Build the standings table: every player who appears in any match, ordered by number of wins (most first), then by name alphabetically.

Return a list of [name, wins] pairs. Players with zero wins are included.

Examples

Input: matches = [["ada","bo","bo"],["bo","cy","cy"],["ada","cy","ada"]]
Output: [["ada",1],["bo",1],["cy",1]]
Input: matches = []
Output: []