```
bool isInterleave(string s1, string s2, string s3) {
if (s1.size() + s2.size() != s3.size())
return false;
if (s1.size() < s2.size())
s1.swap(s2);
vector<bool> dp(s1.size() + 1);
dp[0] = true;
for (size_t j = 0; j <= s2.size(); ++j)
for (size_t i = 1; i <= s1.size(); ++i)
dp[i] = ((dp[i - 1] && s1[i - 1] == s3[i + j - 1])
|| (j > 0 && dp[i] && s2[j - 1] == s3[i + j - 1]));
return dp[s1.size()];
```

}

this code was found in the discussion before, but I got confused! I cannot understand why it need to swap s1 and s2 too get large size dp[]? acturally, the value in dp might be wrong, for example, when i = 0, j=2, the temprary result in dp always get dp[0] = ture, which means the usual dp method's dp[2][0] = true. this is incorrect, when using the transmitting function to get following result, the following result may also be incorrect. but why the final result is still correct?