At coder dp serires

Please help me to understand the logic and give the approach for this problem

hello @Somasree
let say solve(i,j) is function that tells number of ways to reach (i,j).

now .
a) if grid[i][j] has square then we there is not ways to reach at (i,j) hence
solve(i,j) = 0 if grid[i][j]=#
b) grid[i][j] is empty then we have to option to reach here. either we can reach from left i.e (i,j-1) or from top ie (i-1,j)
hence we can write this as
solve(i,j)=solve(i-1,j) + solve(i,j-1) if grid[i][j] is empty

base case
solve(0,0)=1 if it is empty otherwise 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.