코딩테스트/LeetCode
2022. 6. 23.
[LeetCode] 3Sum
문제링크 3Sum - 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 정수로 이루어진 배열 nums가 주어질 때, nums의 element 3개를 뽑아 더 한 경우 0이 되는 element들을 출력하는 문제이다. 정수 요소는 중복되어 주어질 수 있고, 중복되어 사용할 수 있다. 접근 방법 처음에는 start, mid, end 3개의 변수를 통해 nums를 순회하며 0이 되는 경우를 출력하려 하였다. 하지만 [0,0,0,0] => [0,0,0] 이 출력되어야 하는데..