people campers numbered from 1 to people. The counselors want to split everyone into two teams; the teams can be of any size, and one may even be empty.
Some campers have fallen out: a pair [a, b] in conflicts means a and b must not be on the same team.
Return True if everyone can be split into two teams so that no feuding pair ends up together, and False otherwise.people=5, conflicts=[[1, 2], [2, 3], [4, 5]] → True
For example, teams {1, 3, 4} and {2, 5}: no feuding pair ends up together.
people=4, conflicts=[[1, 2], [2, 3], [1, 3]] → False
Players 1, 2 and 3 are all at odds with each other, and three people cannot be split into two teams without a clash.
people=3, conflicts=[] → True
people ≤ 2000conflicts) ≤ 10⁴conflicts[i] = [a, b], 1 ≤ a, b ≤ people, a ≠ bpeople=5, conflicts=[[1, 2], [2, 3], [4, 5]]
True
Run checks the first 3 tests in your browser. Submit checks all 77 tests on the server, hidden ones included.