自己写滴,嘻嘻~妈妈再也不用担心我的回溯了,QAQ~~
var subsetsWithDup = function(nums) {
nums.sort((a,b)=>a-b);
let res=[];
backtracking(0,[]);
return res;
function backtracking(start,temp){
res.push([...temp]);
for(var i=start;i<nums.length;i++){
if(i>start&&nums[i]==nums[i-1]) continue;
temp.push(nums[i]);
backtracking(i+1,temp);
temp.pop();
}
}
};