- 1
Given a sorted array, rearrange the array alternately i.e first element should be max value, second min value, third second max
Given a sorted array, rearrange the array alternately i.e first element should be max value, second min value, third second max, fourth second min and so on. Eg: arr[] = {1, 2, 3, 4, 5, 6, 7} O/P: {7, 1, 6, 2, 5, 3, 4} comment the code
1 Answer
0
Here you go:
https://code.sololearn.com/cj3T1WWp4dly/#cpp