I have an array such as
ABCDEFGHIJK
I want to rotate it N places to the right; for example, if N=3, the array should end
IJKABCDEFGH
Assume that the only available operation is a FLIP method that can invert any portion of the array. For example, applied to the original array FLIP(3,6) would produce ABFEDCGHIJK.
I suppose you could, assuming the array was X long (in this case 11) at all times, use 3 FLIPs
FLIP(1,X) > KJIHGFEDCBA
FLIP (1,N) > IJKHGFEDCBA
FLIP (N+1,X) > IJKABCDEFGH

Posted by Saka
on 20040420 13:06:54 