Wanted help regarding where am i going wrong in my approach to question "print all nodes at distance k from a given node"

link to my code is----https://ide.codingblocks.com/s/53770
I am able to pass only 1 testcase out of 4 in this question.
am I missing on some edge cases?
please help.
thanks in advance sir/ma’am.

Hi Nikhil, the order of numbers in the output of your code is incorrect for some test cases.
Example: It prints 85 17 instead of 17 85

Hey Nikhil, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.