Is Graph Bipartite?
Medium Graphs AI round
How it works
- Press Start. 30:00 on the clock, and it keeps running if you leave the page.
- Use an AI agent. 20 messages, anything about the problem. It can write code, but how you use it is scored.
- Run your code on the examples and your own cases, up to 20 runs in 10 minutes.
- Submit to run the hidden tests and end the round.
What the report looks at Example figures
- SolutionOptimal · O(n)
- Hidden tests12 of 12
- AI agent use78 / 100
- Cost$0.004
- Time14:32 of 30:00
The problem
graph describes an undirected graph of n nodes, numbered from 0 to n - 1, where n is the length of graph: graph[u] lists the nodes linked to node u, and each link appears in both lists of the two nodes it joins. The graph may be in several pieces, and a node may have no links at all.
The graph is bipartite when its nodes can be split into two groups so that every link joins a node of one group to a node of the other, and no link stays inside a group.
Return true if the graph is bipartite and false if it is not.
Practice this in an AI round
30 minutes on this problem with an AI agent beside your code, then a report on your solution and how you used the agent.
Your first AI round is free.
Solve it without the AI agent
Write it in Python, Java or C++, run it on your own cases, and submit against hidden tests.
Open the practice pageMore Graphs
- Number of IslandsAI round · Medium
- Rotting OrangesAI round · Medium
- Word LadderAI round · Hard
- Graph Valid TreeMedium
- Walls and GatesMedium