Rat in a Maze - Backtracking Problem


Works on individual test cases but doesn’t pass all on submit…I wonder what wrong here