AO
Back

ETA / Shortest Path Calculation on Map

Phone ScreenPhone ScreenLast reported May 2026Low Frequency

Problem Overview

Two first-hand phone-screen reports. In one, the interviewer described some semantic-map nodes and asked how to compute the ETA between two given points. The question was vague on purpose: the candidate had to talk it through with the interviewer, make it concrete, then implement it. They read it as a shortest-path problem and wrote Dijkstra, which the interviewer seemed to agree with. The other report calls it a classic Dijkstra question: a start node, some target nodes, the distances between nodes; find the shortest path. That candidate likened it to LeetCode 743 (Network Delay Time).

Part 1 — Travel time between map nodes

Write eta(edges, source, targets, directed=True) -> dict.

  • edges is a list of (u, v, travel_time) tuples, with travel_time >= 0.
  • targets is a list of nodes. Return {target: shortest travel time} for each one, as a float, or None when the target cannot be reached.
  • directed=True means an edge runs from u to v only (a one-way road); directed=False makes every edge two-way.

The function name, the input shapes, None for unreachable and the directed flag are our setup; the reports leave them to the conversation. Settle them with your interviewer first (the clarifications below list the questions).

Approach Trade-offs

Approaches actually attempted in reports — including ones that lost candidates time. Pick deliberately.
ApproachNotes
Bellman-FordHandles negative edge weights but runs in O(VE), much slower than Dijkstra for typical non-negative map edge weights.
A* SearchUses a heuristic (e.g., Euclidean distance) to guide search toward a single target faster than Dijkstra, but more complex to implement and heuristic must be admissible.
BFS (unweighted graph)Optimal and simpler if all edges have equal weight, but inapplicable when edges have varying distances/times.

What Reports Emphasize

Interviewer hints: The question is vague on purpose: the candidate has to talk it through with the interviewer and make it concrete before implementing.

What passers do: One candidate talked the deliberately vague prompt through with the interviewer to make it concrete, then wrote Dijkstra, which the interviewer seemed to agree with; they passed the screen, at a lower level than they applied for.

Practice

Write your own against 7 test cases, or read the worked solution — approach, complexity, and code that runs.
Did this match your interview?

If you have had this round, tell us how close this page was. It is how we keep the pages accurate.

Waymo · Phone Screen · Reported 2× across candidate reports
Is this helpful?