Skip to content

Instantly share code, notes, and snippets.

class Solution {
public boolean isBipartite(int[][] graph) {
int visited[] = new int[graph.length + 100];
// 0 chua tham
// 1 mau do
// -1 mau xanh;
for (int i = 0; i < graph.length; i++) {
if (visited[i] == 0) {
visited[i] = 1;