Same skeleton as 3Sum — sort, fix i, converge left/right —
but instead of collecting exact matches, track whichever sum has landed closest to the target so far.
An exact match is just the closest possible sum, so it short-circuits immediately.
Execution
idle
Press Run to begin.
0 / 0
Speed
Java · running line
fixed ileftrightclosest so far
O(n²) time · O(log n)–O(n) sort space · no duplicate-skipping needed here — closeness to target doesn't care which duplicate triplet produced it.