1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 15:01:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/不含 AAA 或 BBB 的字符串 [string-without-aaa-or-bbb].html
2025-05-25 15:07:48 +08:00

33 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定两个整数 <code>a</code>&nbsp;<code>b</code>&nbsp;,返回&nbsp;<strong>任意</strong>&nbsp;字符串 <code>s</code>&nbsp;,要求满足:</p>
<ul>
<li><code>s</code>&nbsp;的长度为 <code>a + b</code>,且正好包含&nbsp;<code>a</code>&nbsp;<code>'a'</code>&nbsp;字母与&nbsp;<code>b</code><code>'b'</code>&nbsp;字母;</li>
<li>子串&nbsp;<code>'aaa'</code>&nbsp;没有出现在 <code>s</code>&nbsp;中;</li>
<li>子串&nbsp;<code>'bbb'</code> 没有出现在 <code>s</code>&nbsp;中。</li>
</ul>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>a = 1, b = 2
<strong>输出:</strong>"abb"
<strong>解释:</strong>"abb", "bab" 和 "bba" 都是正确答案。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>a = 4, b = 1
<strong>输出:</strong>"aabaa"</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= a, b&nbsp;&lt;= 100</code></li>
<li>对于给定的 <code>a</code><code>b</code>,保证存在满足要求的 <code>s</code>&nbsp;</li>
</ul>
<span style="display:block"><span style="height:0px"><span style="position:absolute"></span></span></span>