Say we have a tournament of some sort. It doesn’t matter what the tournament is for. All we need to know is:
- Each game in the tournament is 1 vs 1
- At the end of a game, each player has a non-negative score (0 or higher)
- Usual rule: higher score wins, but ties are possible
- To keep things fair, at the end of the tournament, everybody has played the same number of games
Given the results of a tournament and the IDs of two players,
we’d like to know which of those two players did better in the overall tournament.
Game results are in the format:
{player1, score1, player2, score2}
Example tournamentResults:
{0, 9, 2, 7},
{1, 11, 14, 2},
{3, 6, 7, 5},
{4, 10, 8, 7},
{5, 12, 12, 12},
{9, 8, 10, 3},
{11,11, 13, 12},
{15, 5, 6, 15},
{0, 5, 14, 8},
{1, 11, 2, 13},
{3, 7, 15, 8},
{4, 7, 10, 3},
{5, 8, 13, 8},
{6, 0, 7, 5},
{8, 9, 12, 6},
{9, 11, 11, 9}
Rule for tie-breaks:
If Alice and Bob finish with the same record,
but Alice played Bob and won,
then Alice is ranked higher.
- Compute each player’s total wins and losses from all matches.
- Compare the two players’records: more wins → better.
- If tied: check their head-to-head match result; the winner ranks higher.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including Google, Amazon, Block providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for these companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.