Section 1Understand Problem
Section 01
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
Problem statement
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 `s = s1 + s2 + ... + sn`, `t = t1 + t2 + ... + tm`, `|n − m| ≤ 1`, and the interleaving is `s1 + t1 + s2 + t2 + ...` or `t1 + s1 + t2 + s2 + ...`. Note: `a + b` is the concatenation of strings `a` and `b`.
Example
s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac" → true
Constraints
0 ≤ s1.length, s2.length ≤ 100 · 0 ≤ s3.length ≤ 200 · s1, s2, and s3 consist of lowercase English letters
Audio recording unsupported on this browser.
WPM—Fillers0Pace—Thinking0%
Explain the problem in your own words
0 words0 chars
AI Review
Write your thinking above first.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.
Ready to submit Section 1?
The reviewer will check whether you stated inputs, output, guarantees, and any assumption you flagged.
Write at least a couple of sentences explaining the problem before submitting.