Why is the o/p for case 10 and 2 ans [4,1] and not [4,2]?


#1

Comment body goes here.


#2

Here we need to find the node from which the maximum distance from it to any leaf in the subtree of is B
According to this statement, In case with 10 and 2,
From root node the max distance to any leaf will be 3, so we will not include it in answer.
For the node which is just left to the root node, the max distance to any leaf is 2 hence it is in answer only.


#3

still didn’t get what you really mean?