Convert Array
The question
Given an array [a1, a2, …, aN, b1, b2, …, bN, c1, c2, …, cN] convert it to [a1, b1, c1, a2, b2, c2, …, aN, bN, cN] in-place using constant extra space
My solution
At first this question felt a little confusing so lets clear a few things.
– There will only be a, b and c
– The size of the array is going to be N*3
– The problem needs to be solved without creating an extra array so the modifications need to be made in the same array