We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 58e95ca commit 59a8e5cCopy full SHA for 59a8e5c
1408. String Matching in an Array
@@ -0,0 +1,17 @@
1
+class Solution {
2
+public:
3
+ vector<string> stringMatching(vector<string>& words) {
4
+ vector<string> result;
5
+
6
+ for (int i = 0; i < words.size(); i++) {
7
+ for (int j = 0; j < words.size(); j++) {
8
+ if (i != j && words[j].find(words[i]) != string::npos) {
9
+ result.push_back(words[i]);
10
+ break;
11
+ }
12
13
14
15
+ return result;
16
17
+};
0 commit comments