Practice Find Words Containing Character
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Find Words Containing Character on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
words = ["leet","code"], x = "e"
Output
[0,1]
# Example 2
Input
words = ["abc","bcd","aaaa","cbc"], x = "a"
Output
[0,2]
# Example 3
Input
words = ["abc","bcd","aaaa","cbc"], x = "z"
Output
[]
Constraints
1 <= words.length <= 50
1 <= words[i].length <= 50
x is a lowercase English letter.
words[i] consists only of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Find Words Containing Character.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.