leetcode

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

1897.cpp (373B)


      1 class Solution {
      2   public:
      3     bool makeEqual(const vector<string> &words) const {
      4         int count[27] = {0};
      5         for (const string &word : words) {
      6             for (const char c : word)
      7                 count[c & 0x1F]++;
      8         }
      9         for (int i = 1; i <= 26; i++) {
     10             if (count[i] % words.size()) return false;
     11         }
     12         return true;
     13     }
     14 };