Leetcode / 2942. Find Words Containing Character
Pick a programming language:
Here is the source code for the solution to this problem.
/**
* @param {string[]} words
* @param {character} x
* @return {number[]}
*/
var findWordsContaining = function(words, x) {
const indices = [];
for (let i = 0; i < words.length; i++) {
if (words[i].includes(x)) {
indices.push(i);
}
}
return indices;
};
Did you like the lesson? 😆👍
Consider a donation to support our work: