코딩테스트/LeetCode
2022. 8. 2.
[LeetCode] Kth Smallest Element In A Sorted Matrix
문제링크 Kth Smallest Element in a Sorted 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 정렬된 2차 행렬을 1차 행렬로 변환했을때 k번째 수를 구하는 문제 접근 방법 1. 2차 행렬을 1차 행렬로 변환하기 2. 변환된 1차 배열을 정렬하기 3. k번째 수를 구하기 라는 간단한 로직으로 풀 수 있다. // 2차 배열을 1차 배열로 변환하는 방법 1 (spread) const matrix = [[1, 2, 3], [4, 5..