2025-01-09 20:29:41 +08:00
|
|
|
|
<p>给你一个字符串 <code>text</code>,你需要使用 <code>text</code> 中的字母来拼凑尽可能多的单词 <strong>"balloon"(气球)</strong>。</p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p>字符串 <code>text</code> 中的每个字母最多只能被使用一次。请你返回最多可以拼凑出多少个单词 <strong>"balloon"</strong>。</p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong class="example">示例 1:</strong></p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/09/14/1536_ex1_upd.jpeg" style="height: 35px; width: 154px;" /></strong></p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>text = "nlaebolko"
|
2022-03-27 20:37:52 +08:00
|
|
|
|
<strong>输出:</strong>1
|
|
|
|
|
</pre>
|
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong class="example">示例 2:</strong></p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/09/14/1536_ex2_upd.jpeg" style="height: 35px; width: 233px;" /></strong></p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>text = "loonbalxballpoon"
|
2022-03-27 20:37:52 +08:00
|
|
|
|
<strong>输出:</strong>2
|
|
|
|
|
</pre>
|
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong class="example">示例 3:</strong></p>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>text = "leetcode"
|
2022-03-27 20:37:52 +08:00
|
|
|
|
<strong>输出:</strong>0
|
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
|
|
|
|
|
|
<ul>
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<li><code>1 <= text.length <= 10<sup>4</sup></code></li>
|
2022-03-27 20:37:52 +08:00
|
|
|
|
<li><code>text</code> 全部由小写英文字母组成</li>
|
|
|
|
|
</ul>
|
2025-01-09 20:29:41 +08:00
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
|
|
<p><strong>注意:</strong>本题与 <a href="https://leetcode.cn/problems/rearrange-characters-to-make-target-string/">2287. 重排字符形成目标字符串</a> 相同。</p>
|