LeetCode
Number of Valid Words for Each Puzzle
Click
here
for an explanation.