leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1684.cpp (463B)


0 class Solution { 1 public: 2 int countConsistentStrings(const string &allowed, const vector<string> &words) const { 3 bool count[26] = {false}; 4 int res = 0; 5 6 for (const char c : allowed) 7 count[c - 'a'] = true; 8 for (const auto &word : words) { 9 for (const char c : word) { 10 if (!count[c - 'a']) goto next; 11 } 12 res++; 13 next:; 14 } 15 16 return res; 17 } 18 };