private void _subsetsWithDup(int[] num, int index, ArrayList<Integer> list, ArrayList<ArrayList<Integer>> results) {
        /* end case */
        if (index == num.length) {
            return;
        }
        
        for (int i = index; i < num.length; i++) {
            list.add(num[i]);
            /* add current subset */
            results.add(new ArrayList<Integer>(list));
            /* recurse to add more elements */
            _subsetsWithDup(num, i+1, list, results);
            list.remove(list.size()-1);
            while (i < num.length - 1 && num[i] == num[i+1]) {
                i++;
            }
        }
    }