LeetCode 97 Interleaving String - Problem Statement

The problem

Determine if s3 is formed by interleaving s1 and s2.

An interleaving preserves the order of characters from both strings but allows mixing.

With s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac":

  • Take "aa" from s1, "dbbc" from s2, "bc" from s1, "a" from s2, "c" from s1.
  • Order preserved in both. Valid interleaving. Return true.

With s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc":

  • No valid interleaving produces this s3.
  • Return false.

Constraints: 00 \le s1.length, s2.length 100\le 100.