Loading problem...
A sports operations platform stores the participating clubs of a league season in a Teams table. The scheduling service needs a complete list of directed fixtures for a double round-robin stage, where each pair of clubs plays twice with swapped home and away roles.
Table: Teams
Task: Generate all valid home-away fixtures.
Fixture rules:
Output requirements:
Supported submission environments:
Teams:
| team_name |
|---------------|
| Harbor United |
| Metro Stars |
| Redwood FC |[
{"home_team":"Harbor United","away_team":"Metro Stars"},
{"home_team":"Harbor United","away_team":"Redwood FC"},
{"home_team":"Metro Stars","away_team":"Harbor United"},
{"home_team":"Metro Stars","away_team":"Redwood FC"},
{"home_team":"Redwood FC","away_team":"Harbor United"},
{"home_team":"Redwood FC","away_team":"Metro Stars"}
]Three teams produce 3 * (3 - 1) = 6 directed fixtures, with both directions included for each team pair.
Teams:
| team_name |
|-----------|
| Alpha |
| Beta |[
{"home_team":"Alpha","away_team":"Beta"},
{"home_team":"Beta","away_team":"Alpha"}
]With two teams, exactly two matches exist, one in each direction.
Teams:
| team_name |
|-----------|
| SoloClub |[]A single team cannot play itself, so no valid fixture rows exist.
Constraints