Spiderman saves the victim

Problem link : CodeChef: Practical coding for everyone

Solution link: I1GDPQ - Online C++ Compiler & Debugging Tool - Ideone.com

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: