Not able to figure out mistake in my solution. Can somone pls help!!

dp state represents no. of ways to go to target given that next move will be 0/1 denoting down/right and the no. of moves left in that direction.

rleft : moves left in right direction

dleft : moves left in downwards direction

heres my code -

#include<bits/stdc++.h>#define m 20011using namespace std;long long int a[301][301];long long int dp[301][301][2][301];int r,c,d;long long solve(int x,int y,int dleft,int rleft){if(x==r && y==c)return 1;if(a[x][y]==0)

Read more… (59 words)