List<int> iList = new List<int>(); private void shift(int n) { for (int i = 0; i < n; i++) { iList.Add(iList[0]); iList.RemoveAt(0); } }
static int[] rotLeft(int[] a, int d) { Queue<int> queue = new Queue<int>(a); Stack<int> stack = new Stack<int>(); while(d > 0) { stack.Push(queue.Dequeue()); queue.Enqueue(stack.Pop()); d--; } return queue.ToArray(); }