My cpp solution easy

int Solution::isInterleave(string A, string B, string C) {

int n=A.length(),m=B.length();

if(n+m!=C.size())
return 0;
//initialize
int dp[n+1][m+1]={0};


for(int i=0;i<=n;i++)
{
    for(int j=0;j<=m;j++)
    {
        if(i==0 && j==0)//if A,B,C all empty
          dp[i][j]=1;
          
          else if(i==0){
              if(B[j-1]==C[j-1])
          dp[i][j]=dp[i][j-1];}
          else if(j==0){
              if(A[i-1]==C[i-1])
          dp[i][j]=dp[i-1][j];}
          
          else if(A[i-1]==C[i+j-1] && B[j-1]!=C[i+j-1])
            dp[i][j]=dp[i-1][j];
          else if(A[i-1]!=C[i+j-1] && B[j-1]==C[i+j-1])
            dp[i][j]=dp[i][j-1];
            else if(A[i-1]==C[i+j-1] && B[j-1]==C[i+j-1])
            dp[i][j]=dp[i-1][j]||dp[i][j-1];
    }
}
return dp[n][m];

}

Click here to start solving coding interview questions