HARDasked at 1 company

Number of Valid Words for Each Puzzle

A hard-tier problem at 47% community acceptance, tagged with Array, Hash Table, String. Reported in interviews at Dropbox and 0 others.

Founder's read

Dropbox asked this problem in live assessments and candidates reported blanking on the bit manipulation angle. You're given puzzles and words. Each puzzle is a string where you count how many words can be formed using only the letters present in that puzzle, with each letter used at most once. The tricky part isn't the logic, it's realizing you need to track letter frequency efficiently, and that bitmasks or a hash table approach beats naive string manipulation. At 47% acceptance, most people get stuck on either the frequency counting or optimizing for multiple puzzles. If this lands in your Dropbox OA and you hit a wall on the approach, StealthCoder solves it invisibly.

Companies asking
1
Difficulty
HARD
Acceptance
47%

Companies that ask "Number of Valid Words for Each Puzzle"

If this hits your live OA

Number of Valid Words for Each Puzzle is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.

Get StealthCoder
What this means

The core insight is that for each puzzle, you need to check which words can be spelled using only its available letters. Naive substring checking fails because letters have limited count. The efficient path uses either a bitmask per word or a frequency map per puzzle. The trap most candidates fall into is iterating naively or not pre-processing the words into a usable form. Since you're checking many words against potentially many puzzles, you want to either build a bitmask representation of each word's letter set (fast comparison, but only works if you ignore counts) or maintain a frequency dictionary per puzzle (more memory but handles counts cleanly). The bit manipulation angle isn't required but cuts runtime significantly. If you understand arrays, hash tables, and the letter-frequency problem pattern, you can brute-force it. Where it gets tricky is optimization. StealthCoder is your safety net if you freeze on whether to use bitmasks, a Trie, or a frequency map during the live assessment.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Number of Valid Words for Each Puzzle recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Number of Valid Words for Each Puzzle interview FAQ

Is this really a hard problem, or did Dropbox make it hard on purpose?+

The acceptance rate is 47%, which puts it solidly in hard territory. The logic is straightforward but the optimization isn't obvious. Most candidates solve it slowly or with a suboptimal approach. It's hard because you need to think about data structure choice, not because the algorithm is complex.

Do I actually need bit manipulation to pass?+

No. A clean hash table or frequency-map solution works fine and will pass time limits for typical constraints. Bit manipulation is a speed optimization if words are short and you only care about letter presence. Hash tables are more intuitive and usually sufficient.

What's the main trap when solving this?+

Forgetting that each letter in a puzzle has a limited count. You can't use 'a' three times if the puzzle only has it twice. Candidates often check if a word's letters are a subset of the puzzle's letters but don't enforce the count constraint correctly.

Does Dropbox ask this often, or was it a one-off?+

We only have one report of Dropbox asking it. That doesn't mean it's rare, Dropbox likely reuses similar patterns. If you're interviewing with them, understanding the frequency-counting approach is worth the prep time.

How does this relate to the Trie topic in the tags?+

A Trie isn't necessary for correctness, but it can optimize word lookups if you need to validate words against a dictionary or filter by pattern. For this specific problem, hash tables are typically cleaner than Trie approaches.

Want the actual problem statement? View "Number of Valid Words for Each Puzzle" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.