Solution Review: Maximum, Minimum Array

This review provides a detailed analysis of the different ways to solve the maximum-minimum array problem.

First solution

First, we make a copy of the input array in an auxiliary array. Then we traverse the auxiliary array from the beginning to the end and alternately insert these values into the input array. For example, we insert the last element at arr[0], then insert the first element at arr[1], and so on.

Solution code

Get hands-on with 1400+ tech skills courses.