목록array_and_string (3)
Bunker
문제 https://leetcode.com/problems/spiral-matrix/ 풀이 정석대로 풀었다. 1) 반복 호출되는 함수를 정의한다. 이 함수는 start_i, start_j, size_m, size_n을 input으로 받아 한 번에 한 까치의 바깥쪽 직사각형을 dest 배열에 집어넣는다. (양파 벗기듯이) 2) 반복 호출되는 함수에는 1씩 점증하는 start_i 및 start_j와, 2씩 줄어드는 size_m 및 size_n이 input으로 주어진다. 고찰 하루가 꼬박 걸린 코드다. 직관적인 아이디어였건만... 인덱스를 다루는 구현 연습이 많이 필요하겠다. size방어를 제대로 못해서 if 문이 들어가있는 것도 큰 패착이다. 코드 https://github.com/suy-lee/algori..
문제 https://leetcode.com/problems/first-missing-positive/ First Missing Positive - 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 풀이 1) Merge Sort를 이용하여 리스트에 있는 숫자를 먼저 오름차순으로 정리 2) 가장 작은 수를 1로 설정하고, - 0보다 작거나 같은 element는 skip - 현재의 가장 작은 수와 동일한 element가 나올 경우, 작은 수를 +1 - 현재의 가장 작은 ..

문제 *7/24 풀이본 https://leetcode.com/problems/product-of-array-except-self/ Product of Array Except Self - 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 특이사항 Product of - '곱셈'이라는 뜻을 상기함. Division을 사용하지 말라는 요구사항을 제대로 읽지 못함. 요구사항을 제대로 읽을 것. returnSize를 넣어주지 않으면 Caller가 Expected Output..