words
, create a bitmask by setting the bit corresponding to each unique letter in the word.puzzles
, do the following:
a. Create a bitmask for the puzzle.
b. Initialize the count of valid words to 0.
c. Generate all submasks of the puzzle bitmask that include the first letter of the puzzle.
d. For each submask, add the frequency of the submask from the map to the count.