Is Graph Bipartition
1.graph will have length in range [1, 100].
2.graph[i] will contain integers in range [0, graph.length - 1].
3.graph[i] will not contain i or duplicate values.
4.The graph is undirected: if any element j is in graph[i], then i will be in graph[j].Example
Input:
[[1,3], [0,2], [1,3], [0,2]]
Output:
true
Explanation:
The graph looks like this:
0----1
| |
| |
3----2
We can divide the vertices into two groups: {0, 2} and {1, 3}.Note
Code
Last updated