The Codetikki cartographers have drawn a map of realm connections. They need to determine if the map contains any circular routes (cycles). Given an undirected graph, determine if it contains a cycle. Output "true" or "false". Input: first line n vertices and m edges, then m lines each with two vertices u v representing an edge.
Example 1:
Example 2:
Constraints:
1 <= n <= 10^5 0 <= m <= 10^5 Vertices are labeled 0 to n-1
Tags:
