1 Interleaving String
Total Accepted: 11803 Total
Submissions: 62216My Submissions
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.
注意右下递推中边界条件:i=0? j=0?
class Solution {
public:
bool isInterleave(string s1, string s2, string s3) {
int n=s1.length(),m=s2.length();
if(n+m!=s3.length()) return false;......
阅读全文