cheetcode

116. Interleaving StringMedium

Check whether a string can be formed by interleaving two other strings in order.

Given strings s1, s2, and s3, return true if s3 is formed by an interleaving of s1 and s2.

The character order inside s1 and s2 must be preserved.

Examples

Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"
Output: true
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"
Output: false

Constraints

  • 0 <= s1.length, s2.length <= 100
  • 0 <= s3.length <= 200