BFS-Shortest Path

Ques link :https://hack.codingblocks.com/contests/c/471/763
my code : https://ide.codingblocks.com/#/s/28585
I am getting WA. Please help me to find the mistake.

https://ide.codingblocks.com/#/s/28757

i have commented the mistakes.

  1. visited array is not used
  2. edges should be bidirectional.
2 Likes

Thank you I got my mistake.