Please check the code , not giving correct output
I hope this solves your problem, if it does, please mark the problem as solved
thank you.
i have corrected it but still code not working for the given test case , also runtime on submission
You need to check on whether n,m is X or not. As we want right most path, you need to modify your recursive call
arr[i][j]=‘1’;
boolean right=ratMaze(arr,i,j+1,m,n);
if(right)
return true;
boolean down=ratMaze(arr,i+1,j,m,n);
arr[i][j]=‘O’; //multiple paths due to this,backtrack
if(right || down){
return true;
}
sir , i have corrected
still the code is not working
sir ,you havnt replied?