words and a list of puzzles puzzles, return a list whose entry i is the number of words in words that fit puzzles[i].
There are many words and many puzzles, so checking every pair is too slow.words=["tool", "lot", "loot", "stool", "too"], puzzles=["tlo", "otsl", "lot"] → [4, 5, 3]
For "tlo": tool, lot, loot and too fit (stool has an s), so 4. For "otsl" all five words fit. For "lot" the key letter is l: too lacks it and stool has an s, leaving 3.
words=["bee", "beef"], puzzles=["fbe", "zbe"] → [1, 0]
"fbe" requires an f, so only beef fits. The key letter of "zbe" is z, which no word contains, so 0.
words=["tool", "lot", "loot", "stool", "too"], puzzles=["tlo", "otsl", "lot"]
[4, 5, 3]
Run checks the first 3 tests in your browser. Submit checks all 35 tests on the server, hidden ones included.