I'm having trouble resolving the Google Foobar question related to finding paths. My solution does not allow to run 2 test cases, the inputs and outputs of which are hidden.
You have maps of parts of the space station, each of which begins in the prison, exit and stop at the door to the rescue unit. The map is presented as a matrix of 0s and 1s, where 0s is the walkable space, and 1s is the impenetrable walls. The door from the prison is in the upper left corner (0,0) and the door to the rescue unit is at the bottom right (w-1, h-1).
Write a function response (map) that generates the shortest path from the prison door to the rescue container, where you are allowed to remove one wall as part of your remodeling plans. Path length is the total number of nodes you go through, counting the input and output nodes. The start and end positions are always passable (0). The card will always be solvable, although you may or may not need to remove the wall. The height and width of the map can be from 2 to 20. Movements can be performed only in the main directions; no diagonal movements are allowed.
Test cases
Inputs: (int) maze = [[0, 1, 1, 0], [0, 0, 0, 1], [1, 1, 0, 0], [1, 1, 1, 0]]
Output: (int) 7
Inputs: (int) maze = [[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]]
Output: (int) 11
In my own testing (grids up to 7x7) this solution works without problems.