Tap here to switch tabs
Problem
Submissions

Problem: Distant Barcodes

Distant Barcodes asks you to rearrange an integer array so that equal values never appear next to each other, then return any arrangement that meets this condition.

Statement

Given an array of integers barcodes, rearrange its elements such that no two adjacent elements are equal. Return any valid arrangement. It is guaranteed that a valid answer always exists.

Constraints:

  • 1≤1 \le barcodes.length ≤10000\le 10000

  • 1≤1 \le barcodes[i] ≤10000\le 10000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Distant Barcodes

Distant Barcodes asks you to rearrange an integer array so that equal values never appear next to each other, then return any arrangement that meets this condition.

Statement

Given an array of integers barcodes, rearrange its elements such that no two adjacent elements are equal. Return any valid arrangement. It is guaranteed that a valid answer always exists.

Constraints:

  • 1≤1 \le barcodes.length ≤10000\le 10000

  • 1≤1 \le barcodes[i] ≤10000\le 10000