Zomato City Zone Bipartite Check
Zomato City Zone Bipartite Check
MediumGraphs0% accepted
Zomato wants to split delivery zones into two non-conflicting teams. A graph is bipartite if nodes can be colored with two colors so no edge connects same-colored nodes. Given adjacency list, check if the graph is bipartite.
Approach
Check if a graph is bipartite using 2-coloring BFS.
Input
4
1 3
0 2
1 3
0 2
Output
true
More Graphs problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards