Two test cases wa and one is tle


rat in a maze problem

hey, is the question tag correct?
the code seems to be of some other problem


here is the solution for rat in a maze problem

it gives tle for 1 case and wa for two case

i have updated the link please check again


use this code for the correct logic, there were a lot of unnecessary steps and mistakes
and hence using this simple logic is better

actually i want to know my mistake in that…my code uses less space…i have just made changes in the board itself…can you fnd mistakes

Assume
The rat can move completely right I.e. everythint is O
It moves to the last column of first row
Not it the printing condition will not be true so it comes further in the function and into the else block
It will call for j+1 again but this goes out of bound and accesses a non existing array index which is an error and this will not break the function ever since this will keep on going on

i have checked for out of bound condition…it will return false and rat will start moving down
also i have run for everything O and its showing right answer

will anyone check my code

please share the updaed code

the code runs fine what is the issue?

submitting it in coding blocks i m getting wa in two test cases
and tle in one

its coding blocks question not giving correct answer in all the cases

could you figure out whats wrong with my code

yesss
line 22 23 need to be commented
then take row and col as global variable

check this condition
if(board[i][j]==‘X’)
return false;
at the start like i have done it at line 7
so the if n-1*m-1 cell is X then it is unreachable hence -1 is shown

please compare my code with ur previous code once to understand better i have updated ur code not made a new one

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.