15 3Sum
15. 3Sum
1. Question
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.
Note:The solution set must not contain duplicate triplets.
2. Implementation
(1) Two Pointers
3. Time & Space Complexity
Two Pointers: 时间复杂度O(n^2)
Last updated
Was this helpful?