2 test case failing

First I built the tree using pr eorder and inorder and verified the code at hackerblocks…It is workign fine.
I created one helper function to print all downwards node.

Then I used kthNode function to call for below nodes at a distance k and for ancestors at a distance of k-d-1.

2 test case failing

You need to print your output in sorted order… As the output is coming correct for the test case but it is not in sorted manner…

Not working…Same 2 test case failing

I have edited your code… Try to submit it now…