Chef and Special Nodes
CodeChefOpen on judge ↗
Chef is viewing a tree and observes that the tree has some special nodes in it. Chef, curious as always wonders what is the minimum distance between any 2 special nodes, but due to the weak eyesight of chef if any two special nodes are adjacent to each other it appears to him as a single special node. (or special group). Due to this constraint of his eyes you have to help chef find the minimum dis
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.
Sign in to chat with the tutor and save your progress.
Sign in to start