Given s1, s2, s3, find whether s3 is formed by the interleaving of
s1 and s2.
For example,
Given:s1 = "aabcc",s2 = "dbbca",
When s3 = "aadbbcbcac", return true.
When s3 = "aadbbbaccc", return false.
判断是否有s1和s2组成,用二维dp,相当与在一个二维数组画个路线图判断能否组成s3
class Solution {
public:
bool isInterleave(string s1, string s2, string s3) {
if(s1.size()+s2.size() != s3.size()) return false;
bool f[1000][1000];
memset(f,0,sizeof(f));
f[0][0] ......
阅读全文