Dijsktra's algo question


wrong answer

Hello @Vibhuti0206

You didn’t print -1 for a vertex that is unreachable from the src vertex.
Example Test case
1
4 2
1 2 5
1 4 3
1

Your output: 5 3
Correct output: 5 -1 3

I have modified your code, here it is