Hacker News new | past | comments | ask | show | jobs | submit login

Works if you assign prime numbers to each letter and multiply instead. So a=2, b=3, etc.



To get decent anagram lengths and complexity, implement the numbers as a dict of repetitions of primes, and implement the multiplication by summing the repetitions. ;-)


In which case you can just compare the dicts without performing the multiplication (which happens to be the costliest part for arbitrary-precision integers).


Exactly.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: