def rotate(matrix):

"""

:type matrix: List[List[int]]

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

"""

length = len(matrix)

```
for i in range(length):
for j in range(length - i):
matrix[i][j], matrix[length - 1 - j][length - 1 - i] = \
matrix[length - 1 - j][length - 1 - i], matrix[i][j]
for i in range(length // 2):
matrix[i], matrix[length - 1 - i] = matrix[length - 1 - i], matrix[i]
```