An alternative and in-place approach to solve the problem :)


#1
vector<int> Solution::rotateArray(vector<int> &A, int B) {
    B = B % A.size();
    reverse(A.begin(),A.begin()+B);
    reverse(A.begin()+B,A.end());
    reverse(A.begin(),A.end());
    return A; 
}