Given an integer array nums, find all unique triplets [a, b, c] such that a + b + c = 0.
Input: one line of space-separated integers. Output: each triplet on its own line with its three numbers in non-decreasing order. Triplets may be produced in any order — the template prints them in a canonical order. Print nothing if there are none.
-1 0 1 2 -1 -4
-1 -1 2 -1 0 1
The distinct zero-sum triplets are (-1,-1,2) and (-1,0,1).
0 1 1
No triplet sums to 0.
Run your code against the sample tests, or Submit to run the full suite.