Skip to content

Commit a5e0305

Browse files
authored
Merge pull request #1353 from sezanhaque/1189
Create: 1189-Maximum-Number-of-Balloons.py
2 parents 02795ef + b32da52 commit a5e0305

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
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)