Algorithm · Amazon · Easy
You are handed a grid with R rows and C columns in which every cell holds one of four symbols: 0 marks an open cell you may walk on, X marks a blocked cell, S marks where you begin, and D marks the target. Movement is very restricted. On your opening move out of S you are free to head up, down, left or right. From that point on, the direction is locked: you must continue in a straight line along the heading you picked. Reversing, turning left and turning right are all…