Arrays: Left Rotation

  • + 0 comments
        int n = a.Count;
    
        for (int i = 0; i < d; i++)
        {
            int firstElement = a[0];
            a.RemoveAt(0);
            a.Insert(n - 1, firstElement);
        }
    
        return a;