Find every triplet that sums to zero, no duplicates. Sort first, then fix
i and slide left / right
inward — sorting is what turns an O(n³) brute force into O(n²).
Execution
idle
Press Run to begin.
0 / 0
Speed
Java · running line
fixed ileftrighttriplet foundduplicate skip
O(n²) time · O(log n)–O(n) sort space · two duplicate guards matter: one for i, one inside the inner scan.