Given n nodes labeled from 0 to n - 1 and a list of undirected edges, find the number of connected components in the graph.
- An integer
n. - A list of edges
edges.
Input: n = 5, edges = [[0,1],[1,2],[3,4]]
Output: 2
Explanation: Components: {0,1,2} and {3,4}.