Help in a spoj question related to bfs

Here is the link to question

Here is the link to my code.

I’m not getting why I’m getting WA though everything in the code seems fine. Please help.

you can try this test case: 10 10 9 0 1
or you can refer to this soln: https://ideone.com/pCDnpT
ps:Don’t forget to upvote;) if you find it useful

1 Like