Challenge: Maximum, Minimum Array
Let’s solve the minimum, maximum array problem.
We'll cover the following
Problem
Given a sorted array, rearrange it into the maximum-minimum form.
Input
A sorted integer array.
Output
An integer array in a maximum-minimum form.
Sample input
array = { 1, 2, 3, 4, 5, 6, 7 }
Sample output
array = [ 7, 1, 6, 2, 5, 3, 4 ]
Let’s look at the illustration below to better understand the problem.
Get hands-on with 1400+ tech skills courses.