# Create tournament schedule

• A tournament has N teams with multiple rounds(N = 2^k where k >=1). Schedule the tournament with the following constraints:

• Every team plays once and only once in a round
• Every team plays every other team only once in the whole tournament

Example:

N = 4
Teams: 1, 2, 3, 4

Round 1: 1-2, 3-4
Round 2: 1-3, 2-4
Round 3: 1-4, 2-3

• This post is deleted!

• I think that Round 1 contradicts to the requirement : Every team plays once and once in a round. In Round 1 team 2 plays twice, with team 1 and team 3. Please clarify.

• This post is deleted!

• @elmirap I need to reword it. Thanks.

• @fuusuke welcome

• @fuusuke what is the relation between number of rounds and number of teams?

• @elmirap It will always be N-1

• @fuusuke I think this is single round-robin tournament. In your case split players into two lines :
1 2
3 4

Round 1 you have 1-3, 2-4 and rearrage

1 3
4 2

Round 2 1-4 , 3-2

1 4
2 3

round 3 1-2 , 4-3

Fix the place of first player and on each round rotate the other elements clockwise

• @elmirap It works for N=4. Does it work for larger N?

• @fuusuke Try it, N is power of 2

• Use a hash-map to store the states, I think a greedy approach works for this problem.

But I think there must be beautiful mathematical approach.

• @xidui Agreed. I solved it via greedy. The challenge is grouping into rounds.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.