Only one test case passed

@narayansatish Your code is tough to read, please do proper indentation and then share the ide link of your code.
Also explain the approach you are using.

IT IS PROPERLY INDENTED

first i have made tree from inorder and preorder.
2. i used search function to search that node from which we have to find distance.
3. after getting that node , i searching all the in k distance away from that node .
4 for anscestor , i am returning k-1 ,that is indication that find the all the node k-1 distance away.
5.nodes which i am getting i am puhing back all these nodes in a vector

@narayansatish
You have used l-1 even in case of r, just correct that.

Also, see this code and try to do indentation like this, it is standard way of doing it, and
easily readable for everyone else https://ide.codingblocks.com/s/221916
Anyways its your choice.

thanks, surely from next time i will keep in mind

@narayansatish Also mark this doubt as resolved after solving it