s1="eat",s2="aet",then s2 is a scrambled string of s1?WHY?


  • 0
    C

    I mean, after reading the description, I think that if s1="eat", then s1 has 4 scrambled strings,that is "eat","eta","ate","tae". But when I set s1="eat",s2="aet" or "tea", the espected answer is "TRUE" rather than "FALSE".WHY? The description does't demenstrate well!!!


  • 0
    E

    @coolkilling eat can be as:

                  eat
               /      \
           ea          t
         /    \
       e     a
    

    When you switch e an a, then you have aet String.


  • 0
    Y

    I get the same problem, and the result shows that we may have more than 1 way to generate the tree.
    when len(s) % 2 == 1 like 'eat', it's child can either be ('ea', 't') or ('e', 'at').


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.