3 ms·
The problem with anagrams is you'd have to test all permutations of a word, which is n! hash lookups. Alternately you could store all prefixes in the set and p
by foobarian 10y ago
The problem with anagrams is you'd have to test all permutations of a word, which is n! hash lookups. Alternately you could store all prefixes in the set and prune the permutations that way. Slightly more interesting than word in set(words).