s3, find whether
s3 is formed by an interleaving of
An interleaving of two strings
t is a configuration where they are divided into non-empty substrings such that:
s = s1 + s2 + ... + sn
t = t1 + t2 + ... + tm
|n - m| <= 1
s1 + t1 + s2 + t2 + s3 + t3 + ...or
t1 + s1 + t2 + s2 + t3 + s3 + ...
a + b is the concatenation of strings
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac" Output: true
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc" Output: false
Input: s1 = "", s2 = "", s3 = "" Output: true
0 <= s1.length, s2.length <= 100
0 <= s3.length <= 200
s3consist of lowercase English letters.
Follow up: Could you solve it using only
O(s2.length) additional memory space?