Only the last test case is passing while the other test cases fail. Please help me find the error in my code asap.
LINK : https://ide.codingblocks.com/s/330763
Print all nodes at a distance k from a given target node
in question it is mention to print ans in sorted form
On T lines print space separated desired output for each test case in sorted form
hence you have to use a vector and instead of printing the node->data push it into vector and in main() first sort vector and then print it
I made the required changes in my code but even now the test cases are getting failed LINK : https://ide.codingblocks.com/s/331231
after line no 45
put a return statement
Sir, It is still not making a difference
at line no 89
you have written
if(dr!=1)
but it should be
if(dr!=-1)
now your code run all testcase except one
there is some problem in that one
which will resolved soon
Modified Code
Yes,it is now passing all the test cases except one.
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.