-
[LeetCode] rotate-image (medium / javascript)개발/알고리즘 2022. 6. 30. 12:50
/**
* @param {number[][]} matrix
* @return {void} Do not return anything, modify matrix in-place instead.
*/
const rotate = function(matrix) {
let answer = [];
const n = matrix.length - 1;
let l = 0;
while (l < n + 1) {
const inner = [];
for(i=n; i>-1; i--) {
inner.push(matrix[i][l]);
}
matrix.push(inner);
l++
}
for(i=0; i<n+1; i++) {
matrix.shift();
}l
};'개발 > 알고리즘' 카테고리의 다른 글
[Greedy] (0) 2022.09.30 [LeetCode] Valid Anagram (easy / javascript) (0) 2022.06.25 [LeetCode] Majority Element II (medium / javascript) (0) 2022.06.25 [LeetCode] Majority Element (easy / javascript) (0) 2022.06.25 [LeetCode] [ 💩꼭 다시 풀어보기 ] Rotate Array (medium / javascript) (0) 2022.06.21