[Python] Rotate Matrix. (Transpose + Reverse)


#1
class Solution:
    def rotate(self, A):
        if not A:
            return None
        
        # Transpose    
        for i in range(len(A)):
            for j in range(i,len(A)):
                
                A[i][j], A[j][i] = A[j][i], A[i][j]
                
        # Reverse        
        for i in range(len(A)):
            A[i].reverse()
            
        return A