• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 08, 2022 |8.4K Views
Check whether a given string is an interleaving of two other given strings
  Share   Like
Description
Discussion

Given three strings A, B and C. Write a function that checks whether C is an interleaving of A and B. C is said to be interleaving A and B, if it contains all and only characters of A and B and order of all characters in individual strings is preserved.

Example:

Input: strings: "XXXXZY", "XXY", "XXZ"
Output: XXXXZY is interleaved of XXY and XXZ
The string XXXXZY can be made by 
interleaving XXY and XXZ
String:    XXXXZY
String 1:    XX Y
String 2:  XX  Z


Check whether a given string is an interleaving of two other given strings: https://www.geeksforgeeks.org/find-if-a-string-is-interleaved-of-two-other-strings-dp-33/