← Questions

Shortest path between two cells in a grid

0
SnowflakeCodingLast asked Feb 2026

Given a grid with open and blocked cells, return the length of the shortest path from a start cell to a target cell moving up, down, left and right. A follow-up changes the question so that a depth-first search with memoization (dynamic programming over the grid) is the natural tool, so be ready to move between BFS and DFS with a memo.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding