class Solution {
public:
bool f[110][110];
bool isInterleave(string s1, string s2, string s3) {
int n=s1.size(),m=s2.size();
if(n+m!=s3.size()) return false;
s1=' '+s1;
s2=' '+s2;
s3=' '+s3;
for(int i=0;i<=n;i++)
for(int j=0;j<=m;j++)
{
if(!j&&!i) f[0][0]=true;
else
{
if(s3[i+j]==s1[i])
f[i][j]=f[i-1][j];
if(s3[i+j]==s2[j])
f[i][j]|=f[i][j-1];
}
}
return f[n][m];
}
};
标签:string,s3,s2,s1,int,交错,字符串,97,size
From: https://www.cnblogs.com/tangxibomb/p/17319671.html