This code is working well for majority of test cases, but there’s one case where the input vector is only containing zeroes, for which it is not working out, I dry runned the code and it seemed to work. I couldn’t figure out why it is not working?

**(Problem)https://leetcode.com/problems/3sum/**

```
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int> > v;
int n=nums.size();
if(n<3)
return {};
sort(nums.begin(),nums.end());
for (int i = 0; i < n; ++i)
{
int target = - nums(i);
int left = i + 1;
int right = n - 1;
while (left <right)
{
int sum = nums(left) + nums(right);
if (sum == target)
{
vector<int> v1;
v1.push_back(nums(i));
v1.push_back(nums(left));
v1.push_back(nums(right));
vector<vector<int> >:: iterator it;
it = find(v.begin(), v.end(), v1);
if (it == v.end())
{
v.push_back(v1);
}
left++;
right--;
}
else
{
if (sum < target)
{
left++;
}
else
{
right--;
}
}
}
}
return v;
}
};
```