by pvillano · 10mo ago · 0 comments
What was your algorithm? Compute a bitset for every word, for each word with 7 unique letters, check against every other word if it has a subset of those letters? Surely there's a better than O(n^2) way
Then find all words with 7 unique letters, then get the unique set of letter sets. These are your valid puzzles times 7 for each selection of a center letter.
Construct a trie of your dictionary. For each letter of each puzzle, walk the trie using only the puzzle letters. When you find a word, if it used the center letter, add to list.
In practice it's log(n) for size of dictionary.