Back to QuestionsPractice with This Question
Number of Connected Components in an Undirected Graph
45.4K views•Asked at Apple•
Medium
Question Explain
Given $n$ nodes and a list of undirected edges, find the number of connected components in the graph. Use BFS/DFS or the Union-Find data structure.
Start Trying This Question Simulation
Practice answering orally or with text to get instant AI feedback.