Graph Theory37 sections · 1633 units
Open in Course

LeetCode 785 Is Graph Bipartite? - Problem Statement

LeetCode 785

Given an undirected graph represented as an adjacency list, determine if it is bipartite. The input is a 22D array graph where graph[i] contains all neighbors of node i. Nodes are labeled 00 to n1n-1. Return true if you can partition the nodes into two groups such that every edge connects nodes in different groups. Return false otherwise. Before reading on, think: how will you track which color each node has?

What value represents "not yet colored"?