diff --git a/1408. String Matching in an Array b/1408. String Matching in an Array new file mode 100644 index 0000000..f25d062 --- /dev/null +++ b/1408. String Matching in an Array @@ -0,0 +1,17 @@ +class Solution { +public: + vector stringMatching(vector& words) { + vector result; + + for (int i = 0; i < words.size(); i++) { + for (int j = 0; j < words.size(); j++) { + if (i != j && words[j].find(words[i]) != string::npos) { + result.push_back(words[i]); + break; + } + } + } + + return result; + } +};