Skip to content

Commit 5394a15

Browse files
committed
Find Words Containing Character
1 parent 055f5e9 commit 5394a15

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
vector<int> findWordsContaining(vector<string>& words, char x) {
4+
vector<int> ans;
5+
for(int i=0;i<words.size();i++){
6+
for(int j=0;j<words[i].size();j++){
7+
if(words[i][j]==x){
8+
ans.push_back(i);
9+
break;
10+
}
11+
}
12+
}
13+
return ans;
14+
}
15+
};

0 commit comments

Comments
 (0)