Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Complete Components

Try to solve the Count the Number of Complete Components problem.

Statement

You are given an integer n denoting the number of vertices in an undirected graph, with vertices numbered from 00 to n −1- 1. You are also given a 22D integer array edges where each edges[i] =[ai,bi]= [a_i, b_i] indicates an undirected edge connecting vertices aia_i and bib_i.

A connected component is considered complete if every pair of vertices within that component is connected by an edge.

Return the total number of complete connected components in the given graph.

Constraints:

  • 1≤1 \leq n ≤50\leq 50

  • 0≤0 \leq edges.length ≤\leq n ×\times(n −1)/2- 1) / 2

  • edges[i].length =2= 2

  • 0≤ai,bi≤0 \leq a_i, b_i \leq n −1- 1

  • ai≠bia_i \neq b_i

  • There are no repeated edges.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Complete Components

Try to solve the Count the Number of Complete Components problem.

Statement

You are given an integer n denoting the number of vertices in an undirected graph, with vertices numbered from 00 to n −1- 1. You are also given a 22D integer array edges where each edges[i] =[ai,bi]= [a_i, b_i] indicates an undirected edge connecting vertices aia_i and bib_i.

A connected component is considered complete if every pair of vertices within that component is connected by an edge.

Return the total number of complete connected components in the given graph.

Constraints:

  • 1≤1 \leq n ≤50\leq 50

  • 0≤0 \leq edges.length ≤\leq n ×\times(n −1)/2- 1) / 2

  • edges[i].length =2= 2

  • 0≤ai,bi≤0 \leq a_i, b_i \leq n −1- 1

  • ai≠bia_i \neq b_i

  • There are no repeated edges.