Solution for 'Maze Pathfinder' problem