图片说明

/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
var rotate = function(matrix) {
    var n = matrix.length
    for(let i=0; i<n-1; i++){
        for(let j=i+1; j<n; j++){
            [matrix[i][j], matrix[j][i]] = [matrix[j][i], matrix[i][j]]
        }
    }
    matrix.forEach(item=>{
        item.reverse()
    });
    return matrix;
};