Given a collection of numbers that might contain duplicates, return all possible unique permutations. Input: [1,1,2] Output: [ [1,1,2], [1,2,1], [2,1,1] ] I am failing on a large test cases can anyone help me where i am doing wrong? please:) ~~~~~ class Solution { public: void solve(vector<vector>&res,int j,vector&nums){ if(j==nums.size()){ res.push_back(nums); return; } for(int i=j;i<nums.size();i++){ if(i==j||nums[i]!=nums[j]){ swap(nums[i],nums[j]); solve(res,j+1,nums); swap(nums[i],nums[j]);} } } vector<vector> permuteUnique(vector& nums) { vector<vector>res; sort(nums.begin(),nums.end()); solve(res,0,nums); return res; } }; ~~~~~