Did not understand the approach

here it is given rat starts from 1,1 then in output why the path starts from 0,0? and what basic path will the rat follow ? will it be go right till you hit block then go down if you hit block go up then go left ?

@chitranshanmol07 it is not mentioned in the problem that grid will be of 0 based indexing so you can’t assume that first position will be at (0,0). sample is given so that you can understand question clearly.so as per sample grid first position will be at (0,0) if you take a 0 based indexing else if you take 1 based indexing it will be at position (1,1).
and it is mentioned in the statement that there will be a unique path so it doesn’t matter which direction you choose first.

@sdevwrat can u your insight if like we can solved this problem using the right down direction then when up and right is given.
Please give a test case we need up and right steps;

3 5
OXOOO
OXOXO
OOOXO

Try this case

@sdevwrat yes u are right can u also give some example where left is happen

5 3
OOO
XXO
OOO
OXX
OOO

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.