```
class Solution:
# @param matrix, a list of lists of integers
# @return a list of lists of integers
def rotate(self, matrix):
n = len(matrix)
for i in range(n):
for j in range(i, n):
tmp = matrix[i][j]
matrix[i][j] = matrix[j][i]
matrix[j][i] = tmp
for i in range(n):
matrix[i] = matrix[i][::-1]
return matrix
```