Search
⌘K

Leetcode 1178. Number of Valid Words for Each Puzzle

For each 7-letter puzzle, count how many words consist only of letters from that puzzle and also include the puzzle's first letter. Key observation: encode words and puzzles as bitmasks, precompute word-mask frequencies, and for each puzzle enumerate subsets of its other 6 letters (2^6) that include the first letter to sum valid words efficiently.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.