Skip to main content
LeetCode 1189, Easy. Topics: Hash Table, String, Counting. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 16 parametrized pytest cases, and a playground notebook:

Problem

Given a string text, you want to use the characters of text to form as many instances of the word “balloon” as possible. You can use each character in text at most once. Return the maximum number of instances that can be formed.

Examples

Example 1
Example 2

Constraints

  • 1 <= text.length <= 10^4
  • text consists of lower case English letters only.

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

NeetCode All.
Last modified on September 7, 2026