Determine if an undirected graph can be colored with two colors.
Constraints
Example
>>> is_bipartite(4, [(0,1),(1,2),(2,3),(3,0)]) True >>> is_bipartite(3, [(0,1),(1,2),(2,0)]) False >>> is_bipartite(1, []) True >>> is_bipartite(0, []) True
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints