Arrays: Left Rotation

  • + 0 comments

    C++ solution

    vector<int> rotLeft(vector<int> a, int d) {
        while(d)
        {
            int temp = a[0];
            a.push_back(temp);
            a.erase(a.begin());
            d--;
        }
        
        return a;
    }