Hi,
I have a problem with move items of an array according to a schema.
This is the purpose of the code:
arrayi= {1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5}
Move items in the array to achieve this:
arrayf= {1,2,3,4,5,5,1,2,3,4,4,5,1,2,3,3,4,5,1,2,2,3,4,5,1}
So:
12345 12345
12345 51234
12345 -> 45123
12345 34512
12345 23451
Obviously this is just one example, the code must be able to give the same result with a n items (n perfect square). I've tried many times but I've have not succeeded.
Thanks in advance for help.
I have a problem with move items of an array according to a schema.
This is the purpose of the code:
arrayi= {1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5}
Move items in the array to achieve this:
arrayf= {1,2,3,4,5,5,1,2,3,4,4,5,1,2,3,3,4,5,1,2,2,3,4,5,1}
So:
12345 12345
12345 51234
12345 -> 45123
12345 34512
12345 23451
Obviously this is just one example, the code must be able to give the same result with a n items (n perfect square). I've tried many times but I've have not succeeded.
Thanks in advance for help.