# Leetcode Problem - 3Sum


## 🧠 Problem

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets.

---

### 🏷️ Tags  
`Array,Two Pointers,Sorting`

---

### 📊 Difficulty  
**Medium**

✅ Success Rate: **31%**  
📥 Submissions: **6,090,299**  
📈 Accepted: **1,886,780**

---

### ❤️ Reactions  
👍 Likes: **17218**  
👎 Dislikes: **1653**

---

### 💡 Hints

So, we essentially need to find three numbers x, y, and z such that they add up to the given value. If we fix one of the numbers say x, we are left with the two-sum problem at hand! For the two-sum problem, if we fix one of the numbers, say x, we have to scan the entire array to find the next numbery which is value - x where value is the input parameter. Can we change our array somehow so that this search becomes faster? The second train of thought for two-sum is, without changing the array, can we use additional space somehow? Like maybe a hash map to speed up the search?

---

### 🔁 Similar Questions

- Two Sum
- 3Sum Closest
- 4Sum
- 3Sum Smaller

