whats the prblm in rhis code
Bfs snake and ladder
@deepakjumani09
There are few mistake in your code. I am pointing those mistake plz correct them
- line no. 32 should be if(dist[nbr]>(dis[node]+1)){
- line 68 should be board[i]=ladder[i];
- line 71 should be board[i]=snake[i];
- delete line 78 to 80 and write
if(i+j<=n){
g.addEdge(i,i+j);
if(board[i+j]!=0){ g.addEdge(i,board[i+j]); }
} - source index in 1 not 0, so change line 85 to g.bfs(1,n);