@@ -0,0 +1,1047 @@
+import java.util.List;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0A%0Aclass Solution %7B%0A    public List%3CList%3CInteger%3E%3E combinationSum2(int%5B%5D candidates, int target) %7B%0A        List%3CList%3CInteger%3E%3E result = new ArrayList%3C%3E();%0A        Arrays.sort(candidates);%0A        backTrack(candidates, target, 0, new ArrayList%3CInteger%3E(), result);%0A        return result;%0A    %7D%0A%0A    private void backTrack(int%5B%5D candidates, int remain, int start, List%3CInteger%3E tempList, List%3CList%3CInteger%3E%3E result) %7B%0A        if (remain %3C 0) %7B%0A            return;%0A        %7D%0A        if (remain == 0) %7B%0A            result.add(new ArrayList%3CInteger%3E(tempList));%0A        %7D else %7B%0A            for (int i = start; i %3C candidates.length; i++) %7B%0A                if (i %3E start && candidates%5Bi%5D == candidates%5Bi - 1%5D) %7B%0A                    continue;%0A                %7D%0A                tempList.add(candidates%5Bi%5D);%0A                backTrack(candidates, remain - candidates%5Bi%5D, i + 1, tempList, result);%0A                tempList.remove(tempList.size() - 1);%0A            %7D%0A        %7D%0A    %7D%0A%7D

40. Combination Sum II