# 3Sum

Given a list of integers, return a list containing all unique triplets in the list such that the sum of the triplet is zero. Each triplet must be sorted in ascending order, and the resulting list must be sorted lexicographically.

#### Parameter

• `nums`: a list of integers

#### Result

• A list of triplets containing all unique triplets that sums up to zero, sorted.

### Examples

#### Example 1

Input: `nums = [-1, 0, 1, 2, -1, -4]`

Output: `[[-1, -1, 2], [-1, 0, 1]]`

#### Example 2

Input: `nums = [1, -1, 2, -2, 3, -3, 4, -4]`

Output: `[[-4, 1, 3], [-3, -1, 4], [-3, 1, 2], [-2, -1, 3]]`

## Title

### Script

Lorem Ipsum is simply dummy text of the printing and typesetting industry. `Lorem` `Ipsum` has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Contrary to popular belief, `Lorem` `Ipsum` is not simply random text.

``````1  >>> a = [1, 2, 3]
2  >>> a[-1]
3  3``````