Scramble String

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. You are given two strings s1 and s2.
2. A string can be represented as a binary tree by partitioning it to two non-empty substrings recursively.
3. If you choose any non-leaf node and swap its two children, then the string formed is the scramble of the original string.
4. You have to determine if s2 is a scrambled string of s1.
Input Format
2 strings s1 and s2
Output Format
Check the sample output and question video.
Question Video
Constraints
1 < length of strings <= 100
Sample Input
great
rgeat
Sample Output
true


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name