反转一个图片
需要认真观察其规律
/*
[0, 0] -> [0, 3]
[0, 1] -> [1, 3]
[1, 0] -> [0, 2]//4-1-1
[i, j] -> [j, n-i -1]//4-0-1
*/
var rotate = function(matrix) {
var n = matrix.length;
var m = matrix[0].length;
var clone = JSON.parse(JSON.stringify(matrix))
for(var i = 0; i < n; i ++){
for(var j= 0; j < m; j++){
matrix[j][n-i-1] = clone[i][j]
}
}
};