Sum (LC #15) finds all unique triplets summing to zero. Sort the array first. For each element, use two pointers on the remaining array to find pairs that sum to its negation. Skip duplicates by checking if current equals previous. When you find a valid triplet, skip duplicate values for both pointers. Sorting costs , and the two-pointer search for each element costs , giving total time. Space is excluding output. Meta asks variants with different target sums or Sum.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/arrays-strings/3sum
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████████████████████████████████████████████████████████