Solution Review: Rearrange Sorted Array in Max/Min Form
This review provides a detailed analysis to help solve the "Rearrange Sorted Array in Max/Min Form" challenge.
We'll cover the following...
We'll cover the following...
Solution 1: Creating a new array
Explanation
In this solution, first create an empty array result whose size is equal to the size of the original array arr. Then start iterating over the array. Store the maximum number in the start of the array, then store the minimum number next to it, and so on. In the end, you should store the result array to the original array. Look at the example below:
Time complexity
The time complexity of this problem is ...