Hello everyone, Recently I encountered following program : Given an integer array of n elements ( where n is a multiple of 3 ), example : *a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4*. You have to rearrange the array in such a manner that the elements of array becomes : *a1, b1, c1, a2, b2, c2, a3, b3, c3, a4, b4, c4*.
Time complexity = O(n) Space complexity = O(1). I was able to write a code where it took *O(n) time, but in O(n) space*. Can anybody suggest me a way to do the code in *O(1) space and O(n) time?* --