DFS Problem With Solution

Connected Components in an Undirected Graph