#3680

Generate Schedule

expert · 1185 · lc medium +32 · 23.9% accepted · 49 likes · top 3%

Description

Given n teams, construct a round-robin schedule where each pair plays twice (once home, once away), one match per day, and no team plays on back-to-back days. Return the schedule as a 2D array where schedule[i] = [home, away]. Any valid schedule is accepted. If none exists, return an empty array.

Code

1
2
3