Skip to content
loading...

re: Learning Algorithms with JS, Python and Java 7: Anagrams VIEW POST

TOP OF THREAD FULL DISCUSSION
re: There's another clever solution using prime numbers which is O(n): You create a map of characters to prime numbers (just use the first 26 primes fo...
 

Nice thing about this method, you can use modulus to check if a string is a substring of another (“apple” to “applesauce”).

That might give false positive for jumbled words, for example paple would pass the modulous check.

code of conduct - report abuse