Ad
  • Custom 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

    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.