Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Maximum Number of Balloons

XPChallenge Points: 10
levelLevel: Easy

You are given a string text that contains various characters.
Your goal is to determine how many complete copies of the word "balloon" can be constructed using those characters.

Each character from text can be used only one time, and the characters must match exactly the letters needed for the word "balloon".
Return the maximum number of full "balloon" words that can be formed.

Example 1:

Input: text = "bbaallooonnll"

Output: 1

Explanation:

Characters allow forming two full “bbaallooonnll” words.

Example 2:

Input: text = "balloonball"

Output: 1

Explanation:

There are enough characters for only one complete “balloon”.

Example 3:

Input: text = "xyzabc"

Output: 0

Explanation:

No required characters to form “balloon”.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result