Spiderman saves the victim

Problem link : http://www.codechef.com/DI15R005/problems/SPIDRMAN

Solution link: http://ideone.com/I1GDPQ

I am doing simple BFS in the problem but I am getting wrong answer. Please give some test cases or where I am going wrong in the logic part.

your approach is right but you missed one case when spiderman and victim is in the same place

1 Like

Thanks a lot…really silly frome me :frowning: