← Questions

Shortest path on a grid with a custom move set

0
OpenAICodingLast asked Oct 2026

An atom sits on a grid of open (.) and forbidden (#) cells and must reach a target cell. Instead of the usual four moves you get a list of allowed moves, each a row and column offset; every move costs one step and can be reused. Return the shortest sequence of moves (as move indexes) from start to target, choosing the lexicographically smallest sequence among the shortest ones, or report that the target can't be reached.

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