← All problemsSign in

Uncommon Cycles

CodeChefRating 3064Open on judge ↗

Chef has a tree with $N$ nodes. He is aware that adding an edge between any two nodes in the existing tree creates a cycle. Chef has **two** extra edges. He wants to add each of two edges between two different nodes. Count the number of ways this can be done so that the new cyclic paths do **not** share any **common edge or node**. Consider the following tree for example: ![](https://cdn.codec

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