Skip to content

Commit

Permalink
Update remove-letter-to-equalize-frequency.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Oct 2, 2022
1 parent 88abfb5 commit 80bc7b7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Python/remove-letter-to-equalize-frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def equalFrequency(self, word):
cnt = collections.Counter(collections.Counter(word))
for c in word:
cnt[c] -= 1
cnt2 = collections.Counter(c for c in cnt.itervalues() if c)
if len(cnt2) == 1:
if len(collections.Counter(c for c in cnt.itervalues() if c)) == 1:
return True
cnt[c] += 1
return False

0 comments on commit 80bc7b7

Please sign in to comment.