I don't know why, but people used Floyd Warshall for solving this q, even though the source(starting node) is specified in the question. I got AC with Bellman-Ford, do follow your own way don't go with other people's solutions. Check this question to see which algorithm to use when (for shortest path questions.)