Based on this solution of permutation I: https://oj.leetcode.com/discuss/18212/my-elegant-recursive-c-solution-with-inline-explanation

I added `if(i!=begin&&num[i]==num[begin])continue;`

in order to skip the duplicate results. I'm wondering if it will success since OJ gave me Output Limit while my xCode IDE can return right results for several test cases. If not, what is the counter example?

Below is my code and anyone know where I go wrong? Thanks a lot.

```
vector<vector<int> > permuteUnique(vector<int> &num) {
vector<vector<int> > res;;
if(num.empty())
return res;
helper(num, 0, res);
return res;
}
//0...begin-1 is already permutated
void helper(vector<int> &num, int begin, vector<vector<int> > &res)
{
if(begin == num.size())
{
res.push_back(num);
return;
}
for(int i = begin; i<num.size(); ++i)
{
if(i!=begin&&num[i]==num[begin])//if equal, then [begin+1,n] would have same permutation, so skip
continue;
swap(num[i], num[begin]);
helper(num, begin+1, res);
swap(num[i], num[begin]);
}
}
```