NODES AT K DISTANCE

I want to print 0 for the nodes which do not exist but getting some error. Plz look into it.

here is your corrected code:


i have marked the corrections
if this solves your doubt please mark it as resolved :slight_smile:

https://ide.codingblocks.com/s/384933 No still its not giving 0 for the mentioned input

for
4
60 65 50 70
50 65 60 70
5
50 3
65 2
70 4
60 3
65 1
its giving
70
70
0
0
50
60