Loading repovive.com/problems/classics/30
Given an undirected graph with vertices and edges, determine if it is bipartite.
A graph is bipartite if its vertices can be divided into two disjoint sets such that every edge connects a vertex in one set to a vertex in the other set. Equivalently, a graph is bipartite if and only if it contains no odd-length cycle.
Output YES if the graph is bipartite, otherwise output NO.