getting all cases wrong while on custom case its correct.
Print all nodes at kdistance
The only issue with the code is that you’ve to print all those nodes which are at distance K in a sorted manner, so instead of directly printing them, you can use a vector to push the data of all the nodes which are at k distance from given node, and while printing the answer you can simply sort the vector and print all the nodes, I’ve made some changes in your code you can check it here.
Hope this helps