|
|
|
|
|
by idontpost
2799 days ago
|
|
Better to use a hash map instead of an array. When iterating the second string, as soon as you see a character without an existing value it's not an anagram. If you finish the second string, check that all values are zero. This way you only need to check the character values you actually use, and not all 127. It also generalizes trivially to larger character sets. |
|