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.
Using a dictionary would be slower than using a simple int array as OP has done. You're adding more overhead/complexity and probably memory usage as well by using a dictionary.
OP's solution is exceedingly fast (see my comment about his error, though). Even much faster than my own (using a short
str1
input...really long ones, my code is much faster), which is faster than all of the other solutions posted here that I've tested.This comment is hidden because it contains spoiler information about the solution
Per kata author's instructions, only lower case letters will be provided. Which means zero non-letters, whitespace, digits, null/empty strings.
I'm nitpicking, but starting for loop from 2 would be give the same output.
This comment is hidden because it contains spoiler information about the solution
+1 Efficiency, only concern is if str2 is empty string then it reports canScramble true, but that's just me being difficult :P