Saturday, September 7, 2019

C++: Rearrange and array in maximum, minimum form

We are given a sorted array and we want to rearrange the array in the form of {max, min, max-1, min+1, max-2, min+2.........}. So here is the code:


Output: {7,1,6,2,5,3,4}

No comments:

Post a Comment