diff --git a/1684. Count the Number of Consistent Strings b/1684. Count the Number of Consistent Strings new file mode 100644 index 0000000..5d877ca --- /dev/null +++ b/1684. Count the Number of Consistent Strings @@ -0,0 +1,23 @@ +class Solution { +public: + int countConsistentStrings(string allowed, vector& words) { + set ans; + for (auto it : allowed) { + ans.insert(it); + } + int count = 0; + for (int i = 0; i < words.size(); i++) { + bool f1 = true; + for (auto it : words[i]) { + if (ans.find(it) == ans.end()) { + f1 = false; + break; + } + } + if (f1) { + count++; + } + } + return count; + } +};