Print all nodes at k distance from a given Node problem

This is my code. It is submitted on leetcode but not working for all test cases on Coding blocks ide.

Please help me with this…

@Mukul70
logic is correct .for coding blocks question output numbers should be in sorted form
That’ll pass all the test cases
Please mark your doubt as resolved if this satisfies :slight_smile: