The code discussed in the video gives wrong and for the following test case
2 2 1
1 2 1
1 2 2
1 2
here in the first line, we have n, num of edges, queries.
following m lines have src, dest, weight.
then q lines have query [src, dest].
The code discussed in the video gives wrong and for the following test case
2 2 1
1 2 1
1 2 2
1 2
here in the first line, we have n, num of edges, queries.
following m lines have src, dest, weight.
then q lines have query [src, dest].
Hello Avi, yeah I understood your input but have you noticed that you have taken multiple edges btw one source and destination, I mean how will you consider the matrix representation.
So in these cases if we have multiple edges we generally take the edges having the minimum distance. So we will only consider 1 2 1 edge. And now the weight btw 1 and 2 is 1. By taking two edges btw same nodes the prev edge gets removed so we also need to take care of that.
I hope it is clear to you. In case it is clear to you pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
In case there is still some confusion pls let me know, I will surely try to help you out.
Thanks
Happy Coding !!