You are viewing a single comment's thread. Return to all comments →
As a note, using toCharArray() is inefficient because it creates a copy of the string. Slightly faster to do a basic loop through the string:
for(int i=0; i<first.length(); i++){ lettercounts[first[i]-'a']++; }
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
As a note, using toCharArray() is inefficient because it creates a copy of the string. Slightly faster to do a basic loop through the string: