Back to the 100
Problem 050Graphs
Medium

Is Graph Bipartite

050

Given an adjacency list encoded as rows of neighbors, return true if the graph is bipartite.

EXAMPLES

Example 1
Input
{
  "graph": [
    [
      1,
      3
    ],
    [
      0,
      2
    ],
    [
      1,
      3
    ],
    [
      0,
      2
    ]
  ]
}

Output
true

FUNCTION SHAPE

graph: intMatrixbool
00:00
2 local tests readyRun with ⌘/Ctrl + Enter. Your code stays in this browser.

Runs solve(...) locally in a browser worker. SWE Playbook does not submit your code. Only run code you trust; Python code may access the network.