please check my code
Rat in a maze problem
it is mentioned in the question that you only have to print the rightmost path, so you should only call down if right == false
I did make the changes and it runs perfectly fine for 2 test cases but failed the rest
there were still couple of mistakes in your code
- you need to reach N-1, M-1 not N, M because we are using 0 based indexing
- you were comparing i to M and j to N which is opposite
Corrected Code
https://ide.codingblocks.com/s/327012