Your question is Maze Path From A to B. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Delta Air Lines models an airport concourse as a rectangular grid. Open cells represent walkable areas, while blocked cells represent restricted zones. Given a start point and destination, return the shortest valid path between them using only four-directional movement.
Implement shortest_path(maze, start, end), where maze is a list of equal-length lists containing 0 for an open cell and 1 for a blocked cell. start and end are coordinate lists of the form [row, column]. Return a list of coordinate lists beginning with start and ending with end. If no path exists, return [].
The path may move up, down, left, or right, but not diagonally. The start and end cells are guaranteed to be within the grid and open. If start == end, return a path containing that single coordinate.
def shortest_path(maze, start, end):