Can anyone point out the Bug in the code?


#1

int dp[1000][1001]={{-1}};

int Solution::uniquePaths(int A, int B) {
if(A==1||B==1)
return 1;
else{
if(dp[A][B]!=-1)
return dp[A][B];
else{
dp[A][B]=uniquePaths(A,B-1)+uniquePaths(A-1,B);
return dp[A][B];
}
}
return -1;
}

It returns 0 for the following testcase
A = 15 , B = 9
Expected result = 319770