You are given a 0-indexed array of strings words and a character x. Return an array of the indices of the words that contain the character x. The returned array may be in any order.
You are given a 0-indexed array of strings words and a character x. Return an array of the indices of the words that contain the character x. The returned array may be in any order.
Example 1:
Input: {"words":["leet","code"],"x":"e"}
Output: [0,1]
Constraints:
1≤words.length≤50
1≤words[i].length≤50
x is a lowercase English letter.
words[i] consists only of lowercase English letters.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"words":["leet","code"],"x":"e"}
Look for the letter 'e' in each of the 2 words. result starts empty.