Shortest Path in a 2D Grid with Obstacles (with Path Reconstruction)
Given a 2D grid of a specified size, start coordinates, and end coordinates, find the shortest path between the two points. The problem is presented in parts: Part 1 — find the shortest distance between start and end on an empty grid; Part 2 — given a list of obstacle coordinates that cannot be traversed, find the shortest distance avoiding them; Part 3 — print the actual path taken for the shortest route.
Asked at:
Anduril
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid July, 2026
Anduril
Mid-level
Part 1: Given the size of a 2D array, start and end coordinates. Find the distance between the two coordinates. Part 2: Now given a list of coordinates of obstacles that you can't traverse, find the shortest distance between the two coordinates. Part 3: Print out the path of the short distance.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.