Algorithm · Waymo · Medium
Requirements Given a starting node, a collection of weighted edges, and a list of target nodes, determine the shortest distance from the source to every target. In the variant where only the closest target matters, return the smallest distance among the targets instead. All edge weights are non-negative. Implement the following function: Represent each edge as (from, to, weight). If a target cannot be reached, preserve the unreachable-distance convention used by the…
Checking your access…