why below is valid abab and aabb isn't it same as abcd bdac which is not scrambled but abab and aabb is?


  • 0
    S

    Input:
    "abab"
    "aabb"

    Output:
    false
    Expected:
    true

    To me this seems incorrect tests got added in this leetCode for this scramble string exercise. Which does not let all the tests pass successfully. As any where in the world scrambling strings has same meaning or definition.


  • 0
    J

    If you split "abab" to "a" and "bab". From "bab" node, further split into "ba" and "b". At this point, if we swap "ba" children, we should get "ab". Thus, we would end up with "aabb".


Log in to reply
 

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