Skip to content

Instantly share code, notes, and snippets.

@kruszczynski
Created August 25, 2026 09:30
Show Gist options
  • Select an option

  • Save kruszczynski/c6e91d35059c3aa2ccb816cd221c14eb to your computer and use it in GitHub Desktop.

Select an option

Save kruszczynski/c6e91d35059c3aa2ccb816cd221c14eb to your computer and use it in GitHub Desktop.
Tennis tournament exercise, part 00

Tennis tournament: two teams

You are organising a tennis tournament, albeit one in a strange format.

The TV rights holders hand you a list of singles matches (1v1) they want to see. To add drama, they also insist on a team element: every player is put on either Team A or Team B, and a player must never face someone from their own team.

Given the list of matchups, assign every player to a team.

matches = [["Alice", "Bob"], ["Charlie", "Alice"], ["David", "Bob"]]

One valid answer:

Alice   -> A
Bob     -> B
David   -> A
Charlie -> B

Ground rules

  • Share your screen and work in a scratch editor (codeshare.io or similar).
  • Think out loud. How you get there matters more than getting there.
  • Ask me questions. The brief above is deliberately not exhaustive.
  • Use any language you like, we want you to be comfortable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment