Javascript 68 ms 98.88%
\nvar subsetsWithDup = function(nums) {\n        \n    nums = nums.sort((a,b) => a-b);\n    \n    const res = [];\n    \n    function fn(length, start=0, arr = 
```\nvar subsetsWithDup = function(nums) {\n        \n    nums = nums.sort((a,b) => a-b);\n    \n    const res = [];\n    \n    function fn(length, start=0, arr = []) {\n        if (arr.length === length) {\n            res.push(arr.slice());\n            return;\n        }\n        for(let i=start; i<nums.length; i++) {       \n            if (i !== start && nums[i-1] === nums[i]) continue;\n            arr.push(nums[i]);\n            fn(length, i+1, arr);\n            arr.pop();            \n        }\n    }\n    \n    for(let length=0; length<=nums.length; length++) {\n        fn(length);\n    }\n    \n    return res;\n};\n```
['JavaScript']