Statement
For a given integer, n, and an array, edges, return the number of connected components in a graph containing n nodes.
Note: The array
edges[i] = [x, y]indicates that there’s an edge betweenxandyin the graph.
Constraints:
nedges.lengthedges[i].lengthxynxyThere are no repeated edges.