LeetCode solutions

2025. Redistribute Characters to Make All Strings Equal

My accepted Python solution to LeetCode problem 2025, Redistribute Characters to Make All Strings Equal, running in 31ms.

  • Difficulty: Easy
  • Python
  • Runtime 31ms
  • Memory 17.6MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 31ms, memory 17.6MB, accepted 2025-12-30.

python
class Solution:
    def makeEqual(self, words: List[str]) -> bool:
        from collections import Counter
        
        total_chars = Counter()
        for word in words:
            total_chars += Counter(word)
        
        n = len(words)
        for count in total_chars.values():
            if count % n != 0:
                return False
        return True

Source