Shortest path using bfs

I am getting wrong answer using the same code as discussed.
My answer is like

Distance from source is

0
1
2
3
4
5
Respectively for each node
Where am i making the mistake?

hello @kabirsachin1999
pls share ur code using cb ide

ur output is correct

bur the output is supposed to be o ,1 ,2,1,2,3
and it is 0,1,2,3,4,5 in my case

as per ur graph->
0-1-2-3-4-5

ur output is correct
0 1 2 3 4 5

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.