← Zoox Interview Insights

Zoox·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Zoox SWE interview with a grid-based reachability problem. Clean problem once you see the trick, but I spent way too long overcomplicating it before the insight clicked.

Questions Asked (1)

Q1

An ice cream truck moves along a 2D integer grid and you're given its position at each time step. A second vehicle starts at the origin and can move one step in any cardinal direction or stay put each turn. Can the second vehicle ever occupy the same cell as the truck at the same time step?

Algorithms & Data Structures
Author's notes

I went down a BFS path for a few minutes before realizing that was completely overkill.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as a reachability question: at each time step, the second vehicle can reach any cell within a Manhattan distance equal to the time elapsed. Check if the truck's position at each time step is within that reachable set. If at any time step the Manhattan distance from the origin to the truck's position is ≤ the time step, then the second vehicle can intercept the truck.

Pro tip: Clarify that the second vehicle can wait, so reachability is not just about shortest paths but about parity and timing. Mention that if the truck's position at time t satisfies |x| + |y| ≤ t and the parity of (|x| + |y|) matches t, then interception is possible; otherwise, it might still be possible if the vehicle can wait, but parity matters for exact timing.

1. Understand the problem

Restate the problem: given the truck's positions at each time step, determine if the second vehicle starting at (0,0) can be at the same cell at the same time. The second vehicle moves one step in cardinal directions or stays put each turn.

2. Define reachability

At time t, the second vehicle can reach any cell (x,y) such that |x| + |y| ≤ t and (|x| + |y|) % 2 == t % 2. This is because each move changes the Manhattan distance from the origin by at most 1, and waiting preserves parity.

3. Check each time step

Iterate through the truck's positions at each time step t. For each position (x,y), check if it is reachable by the second vehicle at time t using the condition above. If any is reachable, return true.

4. Return result

If no time step allows interception, return false. Otherwise, return true as soon as a reachable position is found.

5. Analyze complexity

The algorithm runs in O(n) time where n is the number of time steps, and O(1) extra space. This is optimal since we must examine each time step.

Key Points to Mention

  • Manhattan distance and its relationship to reachability in grid movement
  • Parity condition: the sum of coordinates and time must have the same parity for exact reachability
  • The second vehicle can wait, which affects timing and parity
  • Time complexity: O(n) time, O(1) space
  • Edge cases: truck starts at origin at time 0, truck moves away quickly, negative coordinates
  • Comparison to classic problems like 'escape the ghost' or 'pursuit evasion'

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