Dynamic Programming
LC #97Hard
Interleaving String
Dynamic Programming
GoogleAmazonBloombergProblem
Check if s3 is formed by interleaving s1 and s2 while preserving their relative order.
dynamic-programmingstring
Constraints
- ›0 ≤ s1.length, s2.length ≤ 100
- ›s3.length == s1.length + s2.length
Example
Input
s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"Output
trueWhy
s3 interleaves s1 and s2 preserving their relative orders