1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/距离相等的条形码 [distant-barcodes].html
2022-03-29 12:43:11 +08:00

28 lines
780 B
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>i</code> 个条形码为&nbsp;<code>barcodes[i]</code></p>
<p>请你重新排列这些条形码,使其中任意两个相邻的条形码不能相等。 你可以返回任何满足该要求的答案,此题保证存在答案。</p>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= barcodes.length &lt;= 10000</code></li>
<li><code>1 &lt;= barcodes[i] &lt;= 10000</code></li>
</ul>