Rat in a maze problem

how to understand this rat in a maze problem… couldn’t getting the logic…

I hope you have read and understood the problem statement.
You are given a grid with dimensions nxm. And there is a rat at position (1,1) which wishes to move to position (n,m). The rat can move one step to the right or one step down in the grid, ie, from position (i,j), it can move to positions - (i+1,j) or (i,j+1). There are also some obstacles present in the grid which are denoted by X in the input 2D matrix. We have to output the rat’s path which is denoted by 1’s in the 2D matrix. If it cannot reach the position (n,m), we have to display.
Try to code this using backtracking approach and tell me if you face any problem.

Cannot able to figure out how to use backtracking how to get logic please guide…

Watch the video in your course and try to code that. Start with somewhere atleast.

Code it already but not getting that confidence in this topic…

Well try to solve the standard backtracking problems given in your course. Understand them thoroughly and try to solve it on your own. This much will be enough.

@shampblocks Please mark your doubt as resolved if you are satisfied.

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.