n employees numbered 0 to n - 1. The list conflicts[u] holds the people employee u does not get along with. Conflicts are mutual: if v is in conflicts[u], then u is in conflicts[v]. Nobody clashes with themselves and the lists have no repeats.
Split everyone into two teams (one of them may be empty) so that no two conflicting people end up on the same team.
Return True if this is possible and False otherwise.conflicts=[[1], [0, 2], [1, 3], [2]] → True
The chain 0 — 1 — 2 — 3 splits into teams {0, 2} and {1, 3}.
conflicts=[[1, 2], [0, 2], [0, 1], []] → False
Employees 0, 1 and 2 all clash with one another, so two of them would end up on the same team.
conflicts=[[], []] → True
There are no conflicts, so any split works.
len(conflicts) ≤ 100conflicts[u][i] < n, conflicts[u][i] ≠ uconflicts[u] are distinctv is in conflicts[u], then u is in conflicts[v]conflicts=[[1], [0, 2], [1, 3], [2]]
True
Run checks the first 3 tests in your browser. Submit checks all 66 tests on the server, hidden ones included.