AO
AceOffer
·
Back

Shortest Path on Chess Board (BFS)

Phone ScreenPhone ScreenSoftware Engineer, Machine Learning EngineerLast reported April 2026Low Frequency

Problem Overview

Given a fixed-size chess board, find the shortest path between two positions (e.g., for a knight or similar chess piece).
Full problem statement
Given a fixed-size chess board, find the shortest path between two positions (e.g., for a knight or similar chess piece). You must implement the solution from scratch including main(), custom function signatures with input/output, and your own test cases. The base problem uses a fixed board size. Candidate must discuss tradeoffs between BFS and DFS before choosing an approach.

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 cells on the board are blocked/impassable? How would you modify your solution?
Probes for: After base solution is working correctly
Trade-off discussion
What if the chess board is infinitely large? How would you handle that?
Probes for: After blockage follow-up

Approach Trade-offs

Approaches actually attempted in reports — including ones that lost candidates time. Pick deliberately.
ApproachNotes
DFSDoes not guarantee shortest path; may explore deep paths unnecessarily. Simpler to implement recursively but wrong for shortest-path problems.
BFS with symmetry optimizationConvert (x, y) to first quadrant using symmetry to reduce state space; also allow slightly negative coordinates (e.g., -2) to handle edge cases near the origin. Harder to think of under interview pressure.

Practice

Open the editor to write a solution against test cases, then return here to compare against the follow-ups.
Open Editor →
Waymo · Phone Screen · Reported 3× across candidate reports