The implementation follows the Tree DP template:
Define a recursive function that returns height.
At each node, compute left height and right height.
Update diameter = max(diameter, leftH + rightH) as a side effect.
Return 1 + max(leftH, rightH) to the parent.
This runs in time and space. You will write the full code in the Tree Diameter & Center section.