Wrong outputs for the problem


#1

the testcases are returning these values, These are wrong answers I guess, I request admins to update the solution.

int Solution::solve(string A, string B) {
int count=0,m=A.size(),n=B.size();
vector<vector >dp(m+1,vector(n+1,0));
for(int i=0;i<=m;i++)dp[i][0]=1;
for(int i=1;i<=m;i++){
bool present=0;
for(int j=1;j<=n;j++){
if(A[i-1]==B[j-1]&&dp[i-1][j-1]){
dp[i][j]=1;present=1;
}
else if(dp[i-1][j])dp[i][j]=1;
}
if(present==0)count++;
}
if(dp[m][n]!=1) return 0; //because no subsequence equals to string B
return count;
}

This is my solution, please correct me if any mistakes