mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
28 lines
780 B
HTML
28 lines
780 B
HTML
|
<p>在一个仓库里,有一排条形码,其中第 <code>i</code> 个条形码为 <code>barcodes[i]</code>。</p>
|
|||
|
|
|||
|
<p>请你重新排列这些条形码,使其中任意两个相邻的条形码不能相等。 你可以返回任何满足该要求的答案,此题保证存在答案。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>barcodes = [1,1,1,2,2,2]
|
|||
|
<strong>输出:</strong>[2,1,2,1,2,1]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 2:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>barcodes = [1,1,1,1,2,2,3,3]
|
|||
|
<strong>输出:</strong>[1,3,1,3,2,1,2,1]</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>1 <= barcodes.length <= 10000</code></li>
|
|||
|
<li><code>1 <= barcodes[i] <= 10000</code></li>
|
|||
|
</ul>
|