java.lang.Object
g1101_1200.s1189_maximum_number_of_balloons.Solution

public class Solution extends Object
1189 - Maximum Number of Balloons.<p>Easy</p> <p>Given a string <code>text</code>, you want to use the characters of <code>text</code> to form as many instances of the word <strong>&ldquo;balloon&rdquo;</strong> as possible.</p> <p>You can use each character in <code>text</code> <strong>at most once</strong>. Return the maximum number of instances that can be formed.</p> <p><strong>Example 1:</strong></p> <p><strong><img src="https://assets.leetcode.com/uploads/2019/09/05/1536_ex1_upd.JPG" alt="" /></strong></p> <p><strong>Input:</strong> text = &ldquo;nlaebolko&rdquo;</p> <p><strong>Output:</strong> 1</p> <p><strong>Example 2:</strong></p> <p><strong><img src="https://assets.leetcode.com/uploads/2019/09/05/1536_ex2_upd.JPG" alt="" /></strong></p> <p><strong>Input:</strong> text = &ldquo;loonbalxballpoon&rdquo;</p> <p><strong>Output:</strong> 2</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> text = &ldquo;leetcode&rdquo;</p> <p><strong>Output:</strong> 0</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= text.length <= 10<sup>4</sup></code></li> <li><code>text</code> consists of lower case English letters only.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • maxNumberOfBalloons

      public int maxNumberOfBalloons(String text)