2942.cpp (322B)
1 class Solution { 2 public: 3 vector<int> findWordsContaining(const vector<string> &words, char x) const { 4 vector<int> res; 5 6 for (int i = 0; i < size(words); i++) { 7 if (words[i].find(x) != string::npos) { 8 res.push_back(i); 9 } 10 } 11 12 return res; 13 } 14 };