← All problemsSign in

Vertex Minimization

You are given an undirected graph G of n nodes, numbered from 1 to n having m edges. G does not contain self-loops or duplicate edges. G might not be connected. We define the score of any such graph G as the number of pairs of vertices (u, v) such that there exists exactly 1 path from u to v. Note that a path is a sequence of vertices u1, u2, ..., uk such that: - k ≥ 2, - There exists an ed

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start