class Solution(object):

def rotate(self, matrix):

"""

:type matrix: List[List[int]]

:rtype: void Do not return anything, modify matrix in-place instead.

"""

l = len(matrix)

for i in range(l):

for j in range(l):

if i <= j and i + j <= l - 2:

matrix[i][j], matrix[l - 1 - j][i],matrix[l-1-i][l - 1 - j], matrix[j][l - 1 - i] = matrix[l - 1 - j][i],matrix[l-1-i][l - 1 - j], matrix[j][l - 1 - i], matrix[i][j]