what is wrong
Rat maze problem
in line 22 if(out[i][j+1]!=‘X’)
it should be if(in[i][j+1]!=‘X’)
down call is not else part of right call
modified code
the test cases are not passing
you have to adjust your output according to question requirement
- in line 11 give some spaces cout<<out[k][l]<<" ";
- in line 30 correct one is
down=rat(in,out,i+1,j,n,m);
if(down)return true; - at end you have to also consider a case when there is not possible ans
bool ans=rat(in,out,1,1,n,m);
if(!ans)cout<<"-1";
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course