• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
April 08, 2022 |17.9K Views
Reverse array in groups | SDE Sheet | Arrays
  Share  9 Likes
Description
Discussion

In this video we will see how to reverse an array in groups of a given size. Say for a given size of 3, we are to reverse the first 3 elements of the array. And then the next three and so on. Example: Input: arr = [1, 2, 3, 4, 5, 6, 7, 8, 9] k = 3 Output: [3, 2, 1, 6, 5, 4, 9, 8, 7] Check out the video to see how we implement this!! Next Video: https://www.geeksforgeeks.org/videos/convert-array-into-zig-zag-fashion/ Practice Problem: https://practice.geeksforgeeks.org/problems/reverse-array-in-groups0255/1 Article: https://www.geeksforgeeks.org/reverse-an-array-in-groups-of-given-size/ SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More