Meandering Array
Problem Overview
- Reorder an integer array into meandering order: first largest, first smallest, then alternating next largest and next smallest.
- Input: unsorted int array; Output: same elements in meandering order; Constraints: 2≤n≤10^5, values -10^6 to 10^6, duplicates allowed.
- Domain: array processing/data presentation where values alternate between extremes for visual balance.
- From IBM interviews; a common coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
