Suppose, I take a one-dimensional array of integer
A = {1,2,3,4,5,6,7,8, 9, 10, 11, 12}
Now, I want to to rearrange the integers in A in a two dimensional array with p rows and q columns in diagonal fashion. Where, p=3 and q=4.
Output will be like this:
1 2 4 7
3 5 8 10
6 9 11 12