Back to Questions

Number of Connected Components in an Undirected Graph

45.4K viewsAsked 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.

Practice with This Question