Problem 2642 · Hard

Design Graph With Shortest Path Calculator

Keep the directed adjacency lists growing with addEdge, and answer each shortestPath query with a fresh Dijkstra run.

Open the interactive visualisation