Showing TLE and only 1 test case passing please tell whats wrong ?
Rat in a maze problem
Your mistakes
-
you have to find the righmost path hence first call right and then if right path doesn’t exists then only call down
if(i>m||j>n)
{
return false;
}
here you swap m and n
- also inc size of array by 1 other it may give run time error
Modified Code
Now i after done all the corrections
your code passes all testcases
i hope this helps
if you understand it plz give feedback from link given below
else feel free to ask doubt
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.
Sir i am not able to understand properly how the backtracking is working sol[i][j]=0 in your code and also in the code which i shared , i would be grateful if you would explain that.
sure kindly i will explain
Really sorry sir i could not see the meeting link earlier . Please explain it .This time i will join on time.
No problem
Whenever you are available drop a msg here
I will also join within minutes
I can join now also sir, you can share the link .
yes join now
same link share above
kindly give feedback from above post
Done , given the feedback , thanks for helping.