mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
add leetcode problem-cn part1
This commit is contained in:
27
算法题(国内版)/problem (Chinese)/距离相等的条形码 [distant-barcodes].html
Normal file
27
算法题(国内版)/problem (Chinese)/距离相等的条形码 [distant-barcodes].html
Normal file
@@ -0,0 +1,27 @@
|
||||
<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>
|
Reference in New Issue
Block a user