AO
Back

Shortest Path on Chess Board (BFS)

Phone ScreenPhone ScreenLast reported April 2026Low Frequency

Problem Overview

One first-hand report, from a 45-minute Waymo SWE phone screen: LeetCode 1197 (Minimum Knight Moves), but on a board of fixed size. The candidate briefly compared DFS with BFS and chose BFS. They had to define the function's inputs and outputs, write main and write their own test cases (in Java); the interviewer stayed muted and said little while they coded. The code ran bug-free with 15 minutes left, and the interviewer asked two follow-ups: what if the board has blocked squares, and what if the board is infinite, as in the LeetCode problem. The report does not say whether the follow-ups were coded or only discussed; on this page each is a graded part.

Squares are (row, col) tuples. Return -1 when the target cannot be reached. The function names, the square format and -1 are our setup.

Part 1 — A fixed board

Write min_knight_moves(n: int, start: tuple[int, int], target: tuple[int, int]) -> int: the fewest knight moves from start to target on an n x n board, where both coordinates run from 0 to n - 1.

Part 2 — Blocked squares

Reported follow-up: some squares are blocked. Write min_knight_moves_blocked(n: int, start: tuple[int, int], target: tuple[int, int], blocked: set) -> int, where the knight may not land on any square in blocked. The tests never block the start square.

Part 3 — An infinite board

Reported follow-up: the board has no edges. Write min_knight_moves_infinite(start: tuple[int, int], target: tuple[int, int]) -> int. Any integer square is valid, negative ones included, and every square can be reached.

Follow-up Arc

Interviewers escalate through these phases. The order varies, but most candidates see at least one from each bucket.
Concurrency · 1Trade-off discussion · 1
Concurrency

What if some squares on the board are blocked?

Probes for: After the base solution ran bug-free, with 15 minutes left
Trade-off discussion

What if the board is infinite?

Probes for: After the blocked-squares follow-up

Approach Trade-offs

Approaches actually attempted in reports — including ones that lost candidates time. Pick deliberately.
ApproachNotes
DFSDoes not guarantee the fewest moves without exploring every path; BFS does on an unweighted board.
BFS with symmetry folding (infinite board)A reply to the report suggests folding (x, y) into the first quadrant and allowing coordinates slightly below zero near the origin; it calls both hard to think of on the spot.

What Reports Emphasize

Common mistakes: Adding 'static' to the outer class definition in Java caused a syntax error that took significant time to debug; the interviewer had to hint at the fix.; Being out of practice writing a full Java file from scratch (main(), class definitions, test cases) led to avoidable syntax errors under time pressure.

Interviewer hints: The interviewer was largely silent/muted during the coding portion and only became interactive during the follow-up discussion phase.; The interviewer helped point out the Java 'static outer class' syntax error when the candidate was stuck.

Practice

Write your own against 12 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 1× across candidate reports
Is this helpful?