The Wayback Machine - https://web.archive.org/web/20250114130457/https://www.geeksforgeeks.org/videos/rearrange-array-alternatively/
  • Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
April 18, 2022 |10.0K Views

Rearrange array alternatively | SDE Sheet | Arrays

  Share  9 Likes
Description
Discussion

In this video we will see how to rearrange a given sorted array of positive integers, alternately i.e first element should be maximum value, second minimum value, third second max, fourth second min and so on. 

Example:

Input: [1, 2, 3, 4, 5, 6] 

Output: [6, 1, 5, 2, 4, 3] 

Check out the video to see how we implement this!!

Next video: https://www.geeksforgeeks.org/videos/missing-number-in-array-srik0p/

Practice Problem: https://practice.geeksforgeeks.org/problems/-rearrange-array-alternately-1587115620/1

Article: https://www.geeksforgeeks.org/rearrange-array-maximum-minimum-form/

SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/