class Solution(object):
    def rotate(self, matrix):
        """
        :type matrix: List[List[int]]
        :rtype: void Do not return anything, modify matrix in-place instead.
        """
        n = len(matrix)
        for i in range(n/2):
            for j in range(i,n-i-1):
                tmp = matrix[i][j]
                print tmp
                matrix[i][j]=matrix[n-j-1][i]
                matrix[j][n-i-1],tmp = tmp,matrix[j][n-i-1]
                matrix[n-i-1][n-j-1],tmp = tmp,matrix[n-i-1][n-j-1]
                matrix[n-j-1][i]=tmp
Copy the code