A maze is sized n×m. See the example below. At each cross (i,j), you can move forward, backward, up or down, as long as you do not move out of the maze. There is a symbol at each cross: "." shows the cross is reachable; "❋" shows the cross can not be reached. Starting from a cross (a,b), design an algorithm to reach the destination (c, d) with minimal moves and return the number of moves. If (c,d) is not reachable from (a,b), return -1. (pseudo code is required) Example: Output: 5 (A, b) has to go 4 steps to the right and 1 step to the top to reach (c,d)



Answer :

Other Questions