Given a sorted array, rearrangeĀ  the array alternately i.e first element should be max value, second min value, third second max | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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

4th Aug 2018, 10:09 AM
Raja N
Raja N - avatar
1 Answer
4th Aug 2018, 10:13 PM
Louie
Louie  - avatar