← All problemsSign in

Expected Diameter

CodeChefRating 2908Open on judge ↗

Chef has a tree with $N$ nodes. He has two extra nodes which he wants to be part of the tree. Chef is curious about the diameter of the new tree. Your task is to find the number of new trees with diameter **greater** than the older tree. Note: - Both the new nodes can be possibly connected to same node in the tree. - Both the new nodes can be directly connected to each other. For example, if th

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