Array
16. 3Sum Closest
Same bones as 3Sum — sort, then two pointers — but instead of hunting for an exact zero, you track the smallest |sum − target| seen so far. Sortedness still tells the pointers which way to move: if…
Loading…
Same bones as 3Sum — sort, then two pointers — but instead of hunting for an exact zero, you track the smallest |sum − target| seen so far. Sortedness still tells the pointers which way to move: if…
Loading…