leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1897.cpp (373B)
0 class Solution { 1 public: 2 bool makeEqual(const vector<string> &words) const { 3 int count[27] = {0}; 4 for (const string &word : words) { 5 for (const char c : word) 6 count[c & 0x1F]++; 7 } 8 for (int i = 1; i <= 26; i++) { 9 if (count[i] % words.size()) return false; 10 } 11 return true; 12 } 13 };