Solve "Search a Maze", EPI prob 16.1

The problem is 16.1 in _Elements of Programming Interviews_, v1.3.1.