16
-
[LeetCode] 16. 3Sum ClosestLeetCode 2021. 10. 18. 16:44
https://leetcode.com/problems/3sum-closest/ 3Sum Closest - 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 3Sum Closest 3Sum 문제에서 조금 업그레이드 된 문제다. 더했을때 target이 되는걸 찾아내는게 아닌, target과 가장 가까운 수를 찾아내는 것이다. 풀이방법은 3Sum과 같다. 다만 이번엔 포인터를 움직일때마다 target과 얼마나 가까운지 저장을 해주면 된다. 전체 풀이 코드 class So..