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

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.