2942: Find-Words-Containing-Character
Easy

Literally just iterate through all the letters in each word of words and append the index to the end of ans when word[i] == x.

Code:

class Solution {
public:
    vector<int> findWordsContaining(vector<string>& words, char x) {
        vector<int> ans;
        for (int i = 0; i < words.size(); ++i) {
            for (char& c : words[i]) {
                if (c == x) {
                    ans.push_back(i);
                    break;
                }
            }
        }
        return ans;
    }
};

Complexity:

Time Taken: