Redistribute Characters to Make All Strings Equal - C++ solution -  minimum space complexity o(1)
Intuition\n Describe your first thoughts on how to solve this problem. \nThe goal is to determine if it\'s possible to make all strings in the given array equal
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe goal is to determine if it\'s possible to make all strings in the given array equal by performing a certain type of operation. In each operation, you can move any character from one string to any position in another string.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. **Count Characters:**\n    - Initialize an array `mp` of size 26 (representing the lowercase English letters) to count the occurrences of each character in all strings.\n    - Traverse each string in the array and update the character count in the `mp` array.\n2. **Check Possibility:**\n    - After counting the characters, iterate through the counts in the `mp` array.\n    - If the count of any character is not divisible by the total number of strings (`n`), return false. This is because if the count is not divisible evenly, you won\'t be able to distribute the characters equally among all strings.\n3. **Return Result:**\n    - If the loop completes without returning false, it means that it\'s possible to make all strings equal, and the function returns true.\n\n# Complexity\n### Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n- Let\'s denote:\n   - `m`as the maximum length of any string in the array.\n   - `n` as the number of strings in the array.\n- The nested loops iterate through each character in each string, resulting in a time complexity of `O(m * n)`.\n\n### Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n- The space complexity is O(26) for the `mp` array, which is a constant size. Therefore, the space complexity is O(1).\n\n# Code\n```\nclass Solution {\npublic:\n    bool makeEqual(vector<string>& words) {\n        // Step 1: Count the occurrences of each character in all strings\n        array<int, 26> mp = {};\n        for(auto wrd:words)\n            for(auto ch : wrd)\n                mp[ch-\'a\']++;\n\n        int n = words.size(); // Total number of strings\n\n        // Step 2: Check if it\'s possible to make all strings equal\n        for(auto cnt : mp)\n            if(cnt%n!=0)\n                return false;\n\n        // Step 3: Return the result\n        return true;\n    }\n};\n\n```
['Array', 'Counting', 'C++']