← Questions

Knockout tournament by rank, then build the bracket

0
UberCodingLast asked May 2026

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.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding