Seventy-three days: force buckle 48, rotation image

Address: leetcode-cn.com/problems/ro…

Ideas: violence, find the original array can be changed.

var rotate = function(matrix) { let tem = matrix.length - 1; for(let i = 0; i < tem; i++) { for(let j = i; j < tem - i; j++) { const arr = matrix[i][j]; matrix[i][j] = matrix[tem - j][i]; matrix[tem - j][i] = matrix[tem - i][tem - j]; matrix[tem - i][tem - j] = matrix[j][tem - i]; matrix[j][tem - i] = arr; }}};Copy the code

Execution time: 84 ms, beating 62.74% of all JavaScript commits

Memory consumption: 37.9 MB, beating 40.90% of all JavaScript commits