#C455. Three Sum Problem
Three Sum Problem
Three Sum Problem
Given an array of integers, find all unique triplets such that the sum of the three numbers equals zero. In other words, for triplet \( (a, b, c)\), the equation \(a + b + c = 0\) must hold.
Your task is to implement an efficient algorithm to find all such triplets without duplicate solutions. Each unique triplet should be printed in any order, with its elements separated by spaces on a new line.
inputFormat
The first line contains an integer \(n\) denoting the number of elements in the array. The second line contains \(n\) space-separated integers.
outputFormat
Output all unique triplets, one per line. Each triplet should contain three integers separated by a single space. If no triplet is found, output nothing.
## sample6
-1 0 1 2 -1 -4
-1 -1 2
-1 0 1
</p>