...
/Solution: Number of Connected Components in an Undirected Graph
Solution: Number of Connected Components in an Undirected Graph
Let's solve the Number of Connected Components in an Undirected Graph problem using the Union Find pattern.
We'll cover the following...
We'll cover the following...
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 betweenx
andy
in the graph.
Constraints:
n
edges.length
edges[i].length
...