mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
29 lines
682 B
HTML
29 lines
682 B
HTML
<p>给定一个字符串 <code>s</code> ,检查是否能重新排布其中的字母,使得两相邻的字符不同。</p>
|
|
|
|
<p>返回<em> <code>s</code> 的任意可能的重新排列。若不可行,返回空字符串 <code>""</code></em> 。</p>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>示例 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入:</strong> s = "aab"
|
|
<strong>输出:</strong> "aba"
|
|
</pre>
|
|
|
|
<p><strong>示例 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入:</strong> s = "aaab"
|
|
<strong>输出:</strong> ""
|
|
</pre>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= s.length <= 500</code></li>
|
|
<li><code>s</code> 只包含小写字母</li>
|
|
</ul>
|