Doubt doubt doubt

Did not clear all test cases…why???

hi… so there are 2 faults in ur soln.
if (root == target)
{
// this return the nodes at distance k in sub-tree.
NodeAtK(root, k);
return 0;
}

firstly yha return 0 hoga… not 1…
secondly jo ans hai use ek vector mei store kro…
then at the end sort krke print kro… if vector size is zero then print 0 as the o/p

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.