Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2642. Design Graph With Shortest Path Calculator
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source