Interleaving String
Medium
Topics
Given strings s1, s2, and s3, return true if s3 is formed by an interleaving of s1 and s2 (preserving the order of each).
Example 1
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac" Output: true
Example 2
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc" Output: false
Constraints
- 0 <= s1.length, s2.length <= 100
- s3.length == s1.length + s2.length
- Inputs are lowercase letters.
Run ⌘' · Submit ⌘⏎