From 0e68584bea3e46467ffd459c787cb82e209c2cc6 Mon Sep 17 00:00:00 2001 From: bumpsoo Date: Mon, 22 Jun 2026 10:26:04 +0000 Subject: [PATCH] https://leetcode.com/problems/maximum-number-of-balloons --- easy/maximum_number_of_ballons.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 easy/maximum_number_of_ballons.py diff --git a/easy/maximum_number_of_ballons.py b/easy/maximum_number_of_ballons.py new file mode 100644 index 0000000..cb69077 --- /dev/null +++ b/easy/maximum_number_of_ballons.py @@ -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) \ No newline at end of file