Please correct the code why one test case is failing
BFS Shortest Path One Test case giving wrong Ans
You don’t need to use dijkstra for this question. This can be solved using bfs traversal. And the time for dijkstra will be nlogn whereas for bfs it will be O(n)
You can refer this https://ide.codingblocks.com/s/251386