Search
⌘K

Leetcode 2642. Design Graph With Shortest Path Calculator

Design a class for a directed, positive-weighted graph that supports adding edges and answering shortest-path-cost queries between any two nodes. With n ≤ 100 and up to 100 dynamic edge insertions and 100 queries, the core challenge is maintaining or computing minimum path costs (or returning -1 if unreachable) efficiently as edges are added.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.