3Sum

Medium

📝 Description

Find all unique triplets that sum to zero

Input Format

Space-separated array elements

Output Format

List of triplets

Constraints

0 ≤ array length ≤ 3000

🔍 Sample Input

-1 0 1 2 -1 -4
            

✅ Sample Output

-1 -1 2
-1 0 1
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run