You are given an array of strings words and an array of strings puzzles.
A string word is considered valid with respect to a string puzzle if both of the following conditions are satisfied:
word contains the first letter of puzzle.
Every character present in word is also present in puzzle.
Return an array answer where answer[i] is the number of words in words that are valid with respect to puzzles[i].
Constraints:
words.length
words[i].length
puzzles.length
puzzles[i].length
words[i] and puzzles[i] consist of lowercase English letters.
Each puzzles[i] does not contain repeated characters.
You are given an array of strings words and an array of strings puzzles.
A string word is considered valid with respect to a string puzzle if both of the following conditions are satisfied:
word contains the first letter of puzzle.
Every character present in word is also present in puzzle.
Return an array answer where answer[i] is the number of words in words that are valid with respect to puzzles[i].
Constraints:
words.length
words[i].length
puzzles.length
puzzles[i].length
words[i] and puzzles[i] consist of lowercase English letters.
Each puzzles[i] does not contain repeated characters.