Interleaving String

Given strings s1, s2, and s3, determine if s3 is formed by interleaving s1 and s2. An interleaving configuration requires dividing s1 and s2 into substrings such that they are concatenated alternatively, ensuring the length difference between the two lists of substrings does not exceed one. A concatenation in this context means joining strings end-to-end.

Constraints

  • 0 <= s1.length, s2.length <= 100
  • 0 <= s3.length <= 200
  • s1, s2, and s3 consist of lowercase English letters.
Saving… · 2 lines
class Solution:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
Console

Click Run to execute sample tests.