def min_knight_moves(n, start, target):
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.
Standard explanation — no candidate report records what the interviewer accepted here.
Skip blocked squares when generating neighbours; a blocked target is unreachable.
The candidate says this is the LeetCode problem itself (1197), whose board is infinite. A reply suggests two optimizations: fold (x, y) into the first quadrant by symmetry, and allow coordinates slightly below zero (about -2) near the origin; it calls both hard to think of on the spot.
One Waymo SWE phone-screen report (45 minutes, April 2026). The problem was LeetCode 1197 on a fixed-size board. The candidate compared DFS and BFS, chose BFS, and had to write the function's inputs and outputs, main and test cases themselves, in Java; a stray static on the outer class cost them a while until the interviewer pointed it out. The interviewer was muted and quiet during coding. With the code running bug-free and 15 minutes left, the interviewer asked about blocked squares and an infinite board. The candidate was rejected about a week later. A reply suggests two tricks for the infinite board: fold coordinates into the first quadrant, and allow slightly negative coordinates near the origin.
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.
What if some squares on the board are blocked?
What if the board is infinite?
| Approach | Notes |
|---|---|
| DFS | Does 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. |
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.
If you have had this round, tell us how close this page was. It is how we keep the pages accurate.