LeetCode, 자바스크립트) Rotate image
·
개발/알고리즘(코딩테스트)
문제 Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]Output: [[7,4,1],[8,5,2],[9,6,3]]Input: matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]]Output: [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]] You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).접근노가다는 무조건 아닐거 같고, 어떠한 공식이 있을거 같은데... 시도해 보았으나 실패했다.구글링의 도움을 받음 핵심은 90도 시계방향 회전 = 전치(transpose) + 각 행..