Given strings s1, s2, and s3, return true if s3 is formed by interleaving s1 and s2. The relative order of characters from each input string must be preserved. Pattern focus: Interleaving strings. This is the entry-level feasibility check for the interleaving DP state.
s1 = first string, s2 = second string, s3 = merged target string
true if s3 is an interleaving of s1 and s2
Example 1:
Input:
s1 = "aabcc" s2 = "dbbca" s3 = "aadbbcbcac"
Output:
true
Explanation:
This is a standard valid interleaving example.
Example 2:
Input:
s1 = "aabcc" s2 = "dbbca" s3 = "aadbbbaccc"
Output:
false
Explanation:
The ordering constraint fails.