Interleaving String
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.
思路:
其实是一个动态规划问题:设o1, o2, o3分别为在s1, s2, s3上的下标:
is_interleaving(o1, o2, o3) = is_interleaving(o1-1, o2, o3) || is_interleaving(o1, o2-1, o3);
题解:
class Solution {
public:
bool is_interleaving(
const string& s1, const string&am......
阅读全文