Ad
  • Custom User Avatar

    There is no need to use the boolean, just return false and return true ;-)

    You might have been a victim of the (dubious) "only return once" principle.

  • Default User Avatar

    +1 Efficiency, only concern is if str2 is empty string then it reports canScramble true, but that's just me being difficult :P

  • Custom User Avatar

    Description updated.

  • Custom User Avatar

    Description needs a little update: define vowels, use quotes, etc. (as mentioned in previous comments)

  • Default User Avatar

    Assuming English, 'y' can be regarded as a vowel in certain cases. If there are no other regular vowels 'aeiou' the 'y' acts as a vowel (so it should be moved to the end in theory according to the description). Some examples:
    'myth' -> 'mthy'
    'slyly' -> 'sllyy'
    It might be good enough to check if there are other regular vowels present and if not, move the ys to the end. You would need to verify that the string input is actually a word though and not a garbled string and that might make this way more complicated.