2423. Remove Letter To Equalize Frequency

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2423

class Solution:
    def equalFrequency(self, word: str) -> bool:
        cnt = Counter(word)
        for c in cnt.keys():
            cnt[c] -= 1
            if len(set(v for v in cnt.values() if v)) == 1:
                return True
            cnt[c] += 1
        return False