How should I go about it. quite clueless, My code passed the test cases though.
I looked for distance of each node from root node and also checked if a node is on same side of the tree or not (this for my code would turn wrong as i just checked for left or right, what if it had 3 branches, i am unable to think it’s implementation)
now i added distance from root and max_distance on other branch
and also checked max_dist_on_same_branch - distance of node, max of these two i took it as my answer.
Any help would be appreciated, thanks