Can you please tell me the bugin this question because it is giving wrong answer for only one test case for the question rat in a maze?

if solution doesnt exist then in that case u need to print -1