← All problemsSign in

Special Tree

Alan is very fond of Binary Tree's and every time he gets a binary tree, he finds the diameter and height of the tree and if the difference between the number of nodes on the longest path from the root to leaf and the number of nodes on the longest path between any two nodes is strictly greater than a special value $S$ he calls it a Special Tree. Given the Binary tree rooted at index 1, you have

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