Three Sum
Medium
arrays
Meta
Amazon
Adobe
Given an array of integers nums, return all unique triplets [a, b, c] such that a + b + c == 0. The solution set must not contain duplicate triplets.
Example
three_sum([-1, 0, 1, 2, -1, -4])
# => [[-1, -1, 2], [-1, 0, 1]] (order of triplets/elements may vary)
Test Cases
Python Editor
Output
Click "Run" to see results...