sample cases are passing but getting WA on both Test cases
PLZ HELP
Getting WA on both test cases
@Akshay123
There are few mistakes in the code. I am pointing out them, please correct them
- Itβs an undirected graph, so after line 70 write g.addedge(y,x);
2)Change line 31 to if(dist[nbr]==-1 || (dist[nbr]>dist[node]+1))
Sorry my fault, edited line 11 but with u instead of v, now getting AC!!
what effect it would have if I had used dijstra instead of BFS??
@Akshay123
Is dijsktra different from what you did here? I think itβs same. BFS is searching method used in dijskra algorithm
Ohh yeah right, actually true 
1 Like