18
-
[LeetCode] 18. 4SumLeetCode 2021. 10. 18. 16:49
https://leetcode.com/problems/4sum/ 4Sum - 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 4Sum 역시나 3Sum의 업그레이 버전이다. 풀이는 3Sum에서 한개의 수를 고정하고 투 포인터를 이용했다면, 이 문제에서는 두 개를 고정하고 투 포인터를 이용해주면 된다. 더할때 integer 범위를 초과할 수 있으니 주의하자. 전체 풀이 코드 class Solution { public: vector fourSum(vector& nums..