DEV Community

Discussion on: Anagrams Checker - Three JavaScript Solutions

 
aadibajpai profile image
Aadi Bajpai

Not very efficient or fast, however.

Thread Thread
 
evanoman profile image
Evan Oman

I mean its time complexity is O(n)-ish but yeah the large number multiplication would get you for longer words.

Thread Thread
 
aadibajpai profile image
Aadi Bajpai

26th prime is 101 so I imagine zzzzzzzzzzzzz et all would take more time

Thread Thread
 
codemouse92 profile image
Jason C. McDonald • Edited

It's not efficient, but I wonder if a Cantor pairing of the ord() values would work. It would certainly be optimal if all the strings were two letters. The trouble is, those numbers get very big, very fast.