Advertisement
nikunjsoni

1897

Jun 13th, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     bool makeEqual(vector<string>& words) {
  4.         int ch[26];
  5.         memset(ch, 0, sizeof ch);
  6.         for(auto word: words){
  7.             for(char c: word){
  8.                 ch[c-'a']++;
  9.             }
  10.         }
  11.         int n = words.size();
  12.         for(int i=0; i<26; i++)
  13.             if(ch[i]%n)
  14.                 return false;
  15.         return true;
  16.     }
  17. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement