Skip to content

Latest commit

 

History

History
75 lines (38 loc) · 1.19 KB

File metadata and controls

75 lines (38 loc) · 1.19 KB

中文文档

Description

In a warehouse, there is a row of barcodes, where the i-th barcode is barcodes[i].

Rearrange the barcodes so that no two adjacent barcodes are equal.  You may return any answer, and it is guaranteed an answer exists.

 

Example 1:

Input: [1,1,1,2,2,2]

Output: [2,1,2,1,2,1]

Example 2:

Input: [1,1,1,1,2,2,3,3]

Output: [1,3,1,3,2,1,2,1]

 

Note:

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

Solutions

Python3

Java

...