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

33 lines
1.6 KiB
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<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>,且正好包含<code><font color="#c7254e"><font face="Menlo, Monaco, Consolas, Courier New, monospace"><span style="font-size:12.600000381469727px"><span style="caret-color:#c7254e"><span style="background-color:#f9f2f4">a</span></span></span></font></font></code>&nbsp;<code>'a'</code>&nbsp;字母与&nbsp;<code><font color="#c7254e"><font face="Menlo, Monaco, Consolas, Courier New, monospace"><span style="font-size:12.600000381469727px"><span style="caret-color:#c7254e"><span style="background-color:#f9f2f4">b</span></span></span></font></font></code>&nbsp;<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>