BFS- Shortest Path

Getting segmentation fault. https://ide.codingblocks.com/s/231882

@Rishabh3699 hey let me check your code.

@Rishabh3699 hey in which case input it is showing segmentation fault.

Showing in default test case

@Rishabh3699 hey your logic is not correct ,check this corrected code:https://ide.codingblocks.com/s/70718

Is there a way to solve it without using map?

@Rishabh3699 bro instead of map you can take vector also,but general way is this only.

Found the error in my code. Didnt consider bidirectional edges and had to subtraction 1 from the input because 0 based indexing.

https://ide.codingblocks.com/s/231917. Works now. Thanks anyway.

@Rishabh3699 ok bro glad you solved it and correceted your code.