Rotate a 2D matrix.
Given an n x n integer matrix, rotate it 90 degrees clockwise in place and return the modified matrix. Do not allocate another n x n matrix.
Implement def rotate(matrix):. The input is a non-empty square list of lists, and the output is the same matrix object after rotation.
def rotate(matrix):