목록simulation (2)
N
https://leetcode.com/problems/diagonal-traverse/ Diagonal Traverse - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number[][]} mat * @return {number[]} */ var findDiagonalOrder = function(mat) { const answer = []; const diagonalX = [-1, 1]; const diagonalY = [1, -1]..
https://leetcode.com/problems/spiral-matrix/ Spiral Matrix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 주어진 배열을 Spiral로 순회하면서 수를 저장하는 문제. m과 n을 각각 matrix의 가로, 세로 길이로 저장. direct는 spiral로 순회하기 위한 방향 배열. visited는 방문 여부 확인 배열. x와 y는 현재 좌표를 뜻하며, d는 direct의 인덱스를 나타낸다. rangeCheck() 함..