Informatica Coding Round Question

Given an array with n elements and an integer k. Divide the array into subarrays, each of them containing k ekements.For example:
Input: arr[]={1, 32, 5, 6, 9, 3} and k=2

The subarrays will have elements

{132}, {56}, {93}.

Now sort these subarrays as {56}, {93}, {132}. Merge these subarrays together and display them as the elements of original array in sorted order as

Final output: arr[]={5, 6, 9, 3, 1, 32}

Input : arr[]={1, 32, 5, 6, 9, 3} and k=2 
Output : arr[]={5, 6, 9, 3, 1, 32}

Solution Link:

Write your Interview Experience or mail it to

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.