bumpsoo 2026-06-22 10:26:04 +00:00
parent b402cce21a
commit 0e68584bea

View file

@ -0,0 +1,21 @@
# https://leetcode.com/problems/maximum-number-of-balloons
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
b = 0
a = 0
l = 0
o = 0
n = 0
for char in text:
if char == 'b':
b += 1
elif char == 'a':
a += 1
elif char == 'l':
l += 1
elif char == 'o':
o += 1
elif char == 'n':
n += 1
return min(b, a, l // 2, o // 2, n)