You are given an integer n (vertices numbered 0 to n - 1) and an array edges of undirected edges. Return the number of connected components that are complete, meaning every pair of vertices inside the component is joined by an edge.
You are given an integer n (vertices numbered 0 to n - 1) and an array edges of undirected edges. Return the number of connected components that are complete, meaning every pair of vertices inside the component is joined by an edge.
Example 1:
Input: {"n":6,"edges":[[0,1],[0,2],[1,2],[3,4]]}
Output: 3
Constraints:
1≤n≤50
0≤edges.length≤n⋅(n−1)/2
edges[i].length=2
0≤ai,bi≤n−1, ai=bi
There are no repeated edges.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":6,"edges":[[0,1],[0,2],[1,2],[3,4]]}
6 vertices and 4 edges. A component is complete when every pair of its vertices is joined directly.