C++ Solution O(1) space and O(n) complexity


#1

vector Solution::rotateArray(vector &A, int B) {

for(int i=0;i<B;i++){
    int no = A.front();
    A.erase(A.begin());
    A.push_back(no);
}
return A;

}

Just keeping the track of the first element and pushing it to the end.