Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
After adding each edge, update your graph with the new edge, and you can calculate the shortest path in your graph each time the shortestPath method is called.
Use dijkstra’s algorithm to calculate the shortest paths.