Alternative array sorting


Given an array of integers, print the array in alternating min/max order. The first element should be the first maximum, second element should be the first minimum, third element should be second maximum, etc.

For example:

#Given the following array:
arr[] = [10, 2, 11, 3, 7, 4, 1]

#Your function should return:
11, 1, 10, 2, 7, 3, 4


Access restricted

Subscribe to premium account to see the solution.

Get premium now