3194. Find Words Containing Character
My accepted C++ solution to LeetCode problem 3194, Find Words Containing Character, running in 0ms.
- Difficulty: Easy
- C++
- Runtime 0ms
- Memory 33MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
C++
Accepted on LeetCode — runtime 0ms, memory 33MB, accepted 2025-12-27.
class Solution {
public:
vector<int> findWordsContaining(vector<string>& words, char x) {
vector<int> result;
for (int i = 0; i < words.size(); i++) {
if (words[i].find(x) != string::npos) {
result.push_back(i);
}
}
return result;
}
};