desc.html 784 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<p>在一个仓库里,有一排条形码,其中第 <code>i</code> 个条形码为&nbsp;<code>barcodes[i]</code></p>

<p>请你重新排列这些条形码,使其中两个相邻的条形码 <strong>不能</strong> 相等。 你可以返回任何满足该要求的答案,此题保证存在答案。</p>

<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>

<pre><strong>输入:</strong>[1,1,1,2,2,2]
<strong>输出:</strong>[2,1,2,1,2,1]
</pre>

<p><strong>示例 2:</strong></p>

<pre><strong>输入:</strong>[1,1,1,1,2,2,3,3]
<strong>输出:</strong>[1,3,1,3,2,1,2,1]</pre>

<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ol>
	<li><code>1 &lt;= barcodes.length &lt;= 10000</code></li>
	<li><code>1 &lt;= barcodes[i] &lt;= 10000</code></li>
</ol>

<p>&nbsp;</p>