Scramble String Problem Statement
You are given an integer 'N' and two strings S
and R
, each having the size N
. Determine if you can scramble string S
to obtain string R
using specified operations.
Your task is to return true
if R
is a scrambled string of S
, otherwise return false
.
Example:
Input:
T = 1
N = 3
S = 'abc', R = 'bca'
Output:
true
Constraints:
1 <= T <= 50
1 <= len(S) <= 30
S
andR
consist of lowercase letters only.
Note:
1. Both strings are non-empty and of the same length.
2. You can apply the operations any number of times onS
.
3. Operations can only be applied on the stringS
.
Input:
The first line of the input contains an integer 'T' denoting the number of test cases.
The first line of each test case contains an integer ‘N’, denoting the size of the strings.
The second line of each test case contains two space-separated strings ‘S’ and ‘R’.
Output:
For each test case, print a single line containing either "true" if the string 'R' is a scrambled string of ‘S’, else "false".

AnswerBot
1y
The question asks to determine if string 'R' can be obtained by scrambling string 'S' using certain operations.
The length of both strings 'S' and 'R' should be the same.
The operations can be applied r...read more
Help your peers!
Add answer anonymously...
>
Wunderman Thompson Commerce Technical Associate Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

