Tap here to switch tabs
Problem
Submissions

Problem: Minimum Degree of a Connected Trio in a Graph

Try to solve the Minimum Degree of a Connected Trio in a Graph problem.

Statement

You are given an undirected graph with nn vertices labeled from 11 to nn, represented by a 22D integer array edges where each edges[i] == [ui,vi][u_i, v_i] denotes an edge connecting vertex uiu_i and vertex viv_i.

A connected trio is defined as a subset of three distinct vertices where an edge exists between every pair among the three.

The degree of a connected trio is the total number of edges incident to at least one of the three vertices that are not part of the trio itself.

Return the minimum degree among all connected trios in the graph. If no connected trio exists, return −1-1.

Constraints:

  • 2≤2 \leq n ≤400\leq 400

  • 1≤1 \leq edges.length ≤n×(n−1)2\leq \frac{n \times (n - 1)}{2}

  • edges[i].length =2= 2

  • 1≤ui,vi≤1 \leq u_i, v_i \leq n

  • ui≠viu_i \neq v_i

  • There are no repeated edges.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Degree of a Connected Trio in a Graph

Try to solve the Minimum Degree of a Connected Trio in a Graph problem.

Statement

You are given an undirected graph with nn vertices labeled from 11 to nn, represented by a 22D integer array edges where each edges[i] == [ui,vi][u_i, v_i] denotes an edge connecting vertex uiu_i and vertex viv_i.

A connected trio is defined as a subset of three distinct vertices where an edge exists between every pair among the three.

The degree of a connected trio is the total number of edges incident to at least one of the three vertices that are not part of the trio itself.

Return the minimum degree among all connected trios in the graph. If no connected trio exists, return −1-1.

Constraints:

  • 2≤2 \leq n ≤400\leq 400

  • 1≤1 \leq edges.length ≤n×(n−1)2\leq \frac{n \times (n - 1)}{2}

  • edges[i].length =2= 2

  • 1≤ui,vi≤1 \leq u_i, v_i \leq n

  • ui≠viu_i \neq v_i

  • There are no repeated edges.