Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Tested Python solution for LeetCode 1189 with 16 pytest cases. Generate a practice environment with lcpy.
lcpy gen -n 1189 # by problem number lcpy gen -s maximum_number_of_balloons # by problem name
text
Input: text = "nlaebolko" Output: 1
Input: text = "loonbalxballpoon" Output: 2
Input: text = "leetcode" Output: 0
1 <= text.length <= 10^4
from collections import Counter class Solution: # Time: O(len(text)) # Space: O(1) def max_number_of_balloons(self, text: str) -> int: counts = Counter(text) return min(counts["b"], counts["a"], counts["l"] // 2, counts["o"] // 2, counts["n"])