Find Words Containing Character
You are given a 0-indexed array of strings words and a character x.
Return an array of indices representing the words that contain the character x.
Note that the returned array may be in any order.
Example 1
Input
words = ["leet","code"], x = "e"Output
[0,1]"e" occurs in both words, so indices 0 and 1 are returned.
Example 2
Input
words = ["abc","bcd","aaaa","cbc"], x = "a"Output
[0,2]"a" occurs in "abc" and "aaaa", so indices 0 and 2 are returned.
Constraints
- 1 <= words.length <= 50
- 1 <= words[i].length <= 50
- x is a lowercase English letter.
- words[i] consists only of lowercase English letters.