Skip to content

Commit f78ed9f

Browse files
authored
Create 1189-maximum-number-of-balloons.py
1 parent 40a21a3 commit f78ed9f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from collections import Counter
2+
3+
4+
class Solution:
5+
def maxNumberOfBalloons(self, text: str) -> int:
6+
countText = Counter(text)
7+
balloon = Counter("balloon")
8+
9+
res = len(text) # or float("inf")
10+
for c in balloon:
11+
res = min(res, countText[c] // balloon[c])
12+
return res

0 commit comments

Comments
 (0)