Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Find the connected components of an undirected graph using depth-first search (DFS) or breadth-first search (BFS).
For each connected component, count the number of nodes and edges in the component.
A connected component is complete if and only if the number of edges in the component is equal to m*(m-1)/2, where m is the number of nodes in the component.