Doubt of Rat in a Maze

getting one TLE and one wrong answer other than that all test cases are giving right answer.
Please tell what wrong with my code.

check your code for the sample test case , you will know your mistake.
You are modifying your original String array with 0 and 1 and printing it in the end. Take a new 2D integer array to store your answer.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.