Rat chases it's cheese

CODELINK:https://pastebin.com/aNx1dXh1
I am unable to pass one of the test cases where I am wrong please specify and correct it

Hey! in your code you will provide wrong answer when N,M have X. Also in your each if condition you need to make sure i and j are in range.
Please use coding blocks IDE for providing link to the code.

code link :https://pastebin.com/4ey3BTDN
earlier it was giving me one wa after following your words I am getting only two test cases correct , above is my code link for reference and may you please specify how to use coding blocks id to give code link

Login on the site.


Write code, click save, then copy the url and use it for sharing.
Also, in your if statement you are doing
i+1<N it should be i+1<=N as you have passed N-1 to func.

but I have made an 2d array of size MXN
whose indexing is from 0 to N-1 so i or i+1 should be range of N -1 if I will do i+1<=N
than at cerating that indexing doesn’t exist in my array, I have done N=N-1 so that I could directly write last indexes

You are passing N-1, and M-1 in the function, and your array size is N*M
so doing i+1<=N is write (as here N is N-1 of the original N)
if(i+1 <= N && solution[i+1][j]==0 )

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.