87. Interleaving String
MediumDynamic Programming
Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively, such that the substrings are concatenated in an alternating fashion to form the interleaving. The two strings s and t are said to be interleaving if the resulting string preserves the relative order of the characters within each of the strings.
Examples
Input: aabcc dbbca aadbbcbcac
Output: true
Explanation: s3 interleaves s1 and s2 preserving each one's order.
Constraints
- 0 <= s1.length, s2.length <= 100
- 0 <= s3.length <= 200
- s1, s2, and s3 consist of lowercase English letters.
Loading...
Run checks all cases above. Submit evaluates all test cases.