pls send code for obstacle unique paths ,
How to solve grid unique paths(rat ways) when there is a obastacle in the grid
hello @kishoretaru
it is simple.
just make dp[i][j]=0 if cell (i,j) has obstacle otherwise
dp[i][j]=dp[i-1][j]+dp[i][j-1]
code->
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(obstacle[i][j]==1)
dp[i][j]=0;
else
dp[i][j]=dp[i-1][j]+dp[i][j-1];
}
}
cout<<dp[n][m];