← Waymo Interview Insights

Waymo·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Waymo software engineer interview with a graph shortest-path problem. Pretty classic Dijkstra setup but with multiple targets, which added a small wrinkle. Nothing too wild, but the constraints were large enough that you had to be careful about your implementation.

Questions Asked (1)

Q1

Given a weighted directed graph with n nodes and a list of edges, find the shortest distance from a given source node to each node in a list of target nodes. Return -1 for any target that is unreachable.

Algorithms & Data Structures
Author's notes

Recognized Dijkstra pretty fast, which was good.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that the graph is weighted and directed, and that edge weights are non-negative (or handle negative weights if allowed). Use Dijkstra's algorithm with a priority queue to compute shortest distances from the source to all nodes, then extract distances for the target nodes. If negative weights are possible, use Bellman-Ford instead.

Pro tip: Mention that you can stop Dijkstra early once all target nodes are settled, which can save time if the target set is small. Also, discuss how to handle large graphs by using an adjacency list and a min-heap for efficiency.

1. Clarify requirements and constraints

Ask about edge weight ranges (non-negative?), graph size, and whether the graph is static. Confirm the expected output format (array of distances in the order of targets).

2. Choose the right algorithm

If weights are non-negative, Dijkstra's algorithm is optimal. If negative weights exist, Bellman-Ford is needed. Mention time complexities: O((V+E) log V) for Dijkstra with a binary heap.

3. Implement efficiently

Use an adjacency list to represent the graph and a priority queue (min-heap) to repeatedly extract the node with the smallest tentative distance. Maintain a distance array initialized to infinity, with the source set to 0.

4. Extract target distances

After running the algorithm, iterate through the target list and return the distance if it's less than infinity, otherwise -1. Optionally, stop early if all targets are settled.

5. Analyze and optimize

Discuss time and space complexity, and consider edge cases: unreachable targets, source equals target, multiple edges, and large graphs. Mention potential optimizations like early termination.

Key Points to Mention

  • Dijkstra's algorithm with a priority queue for non-negative weights
  • Time complexity: O((V + E) log V) with a binary heap, space O(V + E)
  • Handling unreachable nodes by returning -1
  • Early termination when all target nodes are settled
  • Edge cases: source in targets, zero-weight edges, disconnected graph
  • Alternative: Bellman-Ford if negative weights are allowed

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.