this question accepting wrong answer
example:
1
ritesh rietsh ireths
Answer should be “Not Possible” instead of “Possible”
Is I misunderstood the question ?
As you can see, you can get “ritesh” by rearranging “rietsh” and “ireths”. So, the answer is “Possible”.
I think it is correct. It is just asking whether S2 and S3 are the permutation of the characters of S1.
but this statements seems like we can rearrange only first two character for s2
S2 → S1 (by rearranging first two characters(‘i’, ‘r’))
similarly we can rearrange only first and last two characters of s3
S3 → S1 (by rearranging first two characters(‘i’, ‘r’) and last two characters(‘s’, ‘h’)).
That was an explanation for sample test case. The problem statement doesn’t mention anything like that.
“This time he has three strings S1, S2, S3 and he wants to find , if it is possible to make S2 and S3 equivalent to S1 by Re-arranging characters of S2 and/or S3 any number of times.”
This is what question says. So, it doesn’t mean you have to just swap 1st two characters or last two. Any two characters can be swapped.
Yeah! Got it thanks
My bad I overthink the problem statement
It is indirectly asking you to check if strings s2 and s3 are anagrams of string s1 or not if I am not wrong.
if i tell it more clearly you just have to work on frequency of characters and the problem will be solved. You can still study about anagrams for more reference.
Just sort the strings and check if they are equal or not.