Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
There is no need to use the boolean, just
return false
andreturn true
;-)You might have been a victim of the (dubious) "only return once" principle.
+1 Efficiency, only concern is if str2 is empty string then it reports canScramble true, but that's just me being difficult :P
Description updated.
Description needs a little update: define vowels, use quotes, etc. (as mentioned in previous comments)
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.