i have tried the code using given pseudo code,but still it is not working
could you provide with an alternate code?
Node at a distance k from target
Vibhuti, I have edited your code a little bit…I have used class instead of struct and also I have edited all the required functions… The only thing now you need to do is that, in the question it is given that you are having inorder and preorder arrays, so use those arrays and using them build your tree first and then for every test cases, you need to print the values… Also take the target node as int type instead of node…