Knockout tournament by rank, then build the bracket

0
Remix

Players are listed by rank, where a smaller number is a better player. Neighbours play each other (index 0 against 1, 2 against 3, and so on) and the better rank advances, round after round, until one player is left.

  1. Simulate the tournament and output each round's survivors. Handle an odd number of players.
  2. Go the other way: build a starting order in which, of any two players, the better-ranked one is knocked out later.

One report ended with questions on storing and querying match records in a database.

UberTechnical phone screenLast asked May 2026
No answer yet. Write the first one; the best answer gets endorsed.