Skip to content

Commit a5cd487

Browse files
authored
Create 3014.py
1 parent f242999 commit a5cd487

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

leetcode3/김민제/3014.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from collections import Counter
2+
3+
class Solution:
4+
def minimumPushes(self ,word:str) -> int:
5+
count = Counter(word)
6+
frequencies = sorted(count.values(), reverse=True)
7+
8+
answer = 0
9+
10+
for i,freq in enumerate(frequencies):
11+
push = i//8 +1
12+
answer += push * freq
13+
14+
return answer
15+
16+
17+
input = 'aabcde'
18+
solution = Solution()
19+
print(solution.minimumPushes(input))

0 commit comments

Comments
 (0)