← All problemsSign in

Not even planar

CodeChefRating 3032Open on judge ↗

You're given an undirected graph G with N vertices and M edges. A triangle in this graph is a cycle of length 3. Triangles are stupid and nobody likes them, so you should remove some (possibly zero) vertices from this graph in such a way, that the resulting graph doesn't contain any triangle. In addition, the number of removed vertices should be minimum possible. Note that if you remove a vertex

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