🚀 Beats 100% | Short but Sweet One | Just Give me 5 Min 😎
Intuition  \uD83E\uDD14\nThe task is to check whether it\'s possible to make all the strings in the given array equal by redistributing characters among them. I
# Intuition  \uD83E\uDD14\nThe task is to check whether it\'s possible to make all the strings in the given array equal by redistributing characters among them. It does so by counting the frequency of each character and ensuring that the count of each character is divisible by the total number of strings.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach \uD83D\uDEE3\uFE0F\n1. Initialize an array `freq` to store the frequency of each character in the English alphabet.\n2. Iterate through each string in the input array (`words`).\n3. For each character in the current string, update the frequency array (`freq`) accordingly.\n4. After counting the frequencies, check if the count of each character is divisible by the total number of strings (`n`).\n5. If any character\'s count is not divisible evenly, return `false` since it\'s not possible to make all strings equal.\n6. If all characters\' counts are divisible, return `true`.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n**Time Complexity** \u23F0:\n- The code iterates through each character in each string, leading to a time complexity of O(L), where L is the total number of characters in all strings combined.\n\n**Space Complexity** \uD83D\uDCBE:\n- The code uses a constant amount of space for the array `freq` (26 integers), resulting in a space complexity of O(1).\n\n# Code\n```\nbool makeEqual(vector<string>& words) {\n    // \uD83D\uDE80 Optimizing input/output operations for speed\n    ios_base::sync_with_stdio(false);\n    cin.tie(0);\n    cout.tie(0);\n\n    // \uD83D\uDCCA Initialize an array to store character frequencies\n    int freq[26] = {0};\n    int n = words.size(); // Total number of strings\n\n    // \uD83D\uDD04 Iterate through each string in the array\n    for(auto x : words) {\n        // \uD83D\uDCC8 Update character frequencies\n        for(auto ch : x) {\n            freq[ch - \'a\']++;\n        }\n    }\n\n    // \uD83E\uDDD0 Check if character counts are divisible by the total number of strings\n    for(int i = 0; i < 26; i++) {\n        if(freq[i] % n != 0)\n            return false;\n    }\n\n    // \u2705 All strings can be made equal\n    return true;\n}\n```\n![lc1.png](https://assets.leetcode.com/users/images/0c481881-4ce6-4f7e-9c46-a139ac54269d_1703918649.7107046.png)\n
['Hash Table', 'String', 'C', 'Counting', 'Python', 'C++', 'Java', 'JavaScript']