public void generateComb2(ArrayList<ArrayList<Integer>> result,ArrayList<Integer> list,int[] num,int target,int index){
        if (target == 0){
            ArrayList<Integer> temp = new ArrayList<Integer>();
            for (int i = list.size()-1;i>=0;i--){
                temp.add(list.get(i));
            }
            result.add(temp);
            return;
        }
        else {
            for (int i = index;i>=0;i--){
                if (num[i]<=target&&(i==index||num[i]!=num[i+1])){
                    list.add(num[i]);
                    generateComb2(result,list,num,target-num[i],i-1);
                    list.remove(list.size()-1);
                }
            }
        }
    }