Print all the nodes at distance K from a given code

I am not getting what is the segmentation fault here

hi so why are u taking two inputs n and m… read the ques… n == m so take input only once… secondly result should be sorted so store it in vector/ array sort it and then print…
u can refer to my code https://ide.codingblocks.com/s/608213

can you please again. first of all it is not printing. second when I did with arr it was printing the same value 2 times that input value 60 65

do check my code. dont send reference please

ok… so there were 3-4 minor mistakes… i have corrected ur code… its working find and passing all test cases now https://ide.codingblocks.com/s/608815

i hope now ur doubt is cleared…

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.