Tree queries doubt

why are we going till farthest? what does s farthest node represent : node at max depth on path or node at max depth in tree

this is the farthest node

Can you please tell me how can we find the path if we found the nodes?

can you tell???

yes its given in the video , we first assume that there exists such a path and make the ans yes. now you just need to check if the nodes lie on that path , so to check that we have the basic condition explained that in of that node should be greater than in of farthest and out of node should be smaller than in of farthest
try to debug this code once with pen and paper for all the cases in the input and you ll get it

Do I have to check all paths from root to get that path?

no we just find the farthest node and depth in the first half of code and then go on to check if that pat is valid.PLEASE debug the code discussed once using pen and paper .its very easy you ll get it