I have some questions

Q1: i dont understand K-L-1. Q2: WHY L-1, Q3: WHAT IS L ? AND Q4: WHY -1 ?


Q5: can u point out L,L-1 using this example. Take target=7 and k=4
Q6: Can u explain this " From root , say the target node is at depth 3 in the left branch. It means that any nodes that are distance K - 3 in the right branch should be added to the answer. " ?

Hey, L represent whether target node is in left subtree or not of current node.If it is then we find return distance of current node from target node in the form of L. else we make -1 ie.target node is not in left subtree.
We do K-L-1 as we know that from current node if we go down L steps in the left subtree we will get the target node.So , from current node we should print all nodes that are at k-L-1 distance in the right subtree.
Note: we do K-L-1 and not K-L as we make print function for printing a node’s subtree with distance k from the node in such a way that we print the node when k is 0 and not 1.So,if we have to travel just one node to the right of current subtree we will give k as 0 to right and not 1 since, we are printing only when k is 0.

sorry i cant visualize what u said, you are not answering what i asked for. can you reply A1=. wise

Regarding Q6. yes it is true and it is quite obvious why it i true.
First of all from current node you will have to go 3 steps down to reach the target node, So for any node which is at K-3 distance in right subtree of given node will be at k distance to target node as we will travel k-3 to reach current node from right subtree node and then will go down 3 to reach the target node in the left side.So total distance k-3+3=k