Very easy c++ solution(in place)


#1

Transpose the array and reverse the rows

void Solution::rotate(vector<vector<int> > &A) {
    int n=A.size();
    
    int row=0,col=0;
    
    
    for (int i = 0; i < n; i++)
        for (int j = i+1; j < n; j++)
            swap(A[i][j], A[j][i]);
            
    for(int i=0;i<n;i++){
        reverse(A[i].begin(),A[i].end());
    }        
    
    
}