combination sum
給定壹個無重復元素的數組 candidates 和壹個目標數 target ,找出 candidates 中所有可以使數字和為 target 的組合。
candidates 中的數字可以無限制重復被選取。
說明:
所有數字(包括 target)都是正整數。
解集不能包含重復的組合。
給定集合candidates=[2,3,6,7], target=7
返回 [[7],[2,2,3]]
combination sumII
給定壹個數組 candidates 和壹個目標數 target ,找出 candidates 中所有可以使數字和為 target 的組合。
candidates 中的每個數字在每個組合中只能使用壹次。
說明:
所有數字(包括目標數)都是正整數。
解集不能包含重復的組合。
給定集合candidates = [10,1,2,7,6,1,5], target = 8,
返回 [[1, 7],[1, 2, 5],[2, 6],[1, 1, 6]]
combination sumIII
找出所有相加之和為 n 的 k 個數的組合。組合中只允許含有 1 - 9 的正整數,並且每種組合中不存在重復的數字。
說明:
所有數字都是正整數。
解集不能包含重復的組合。
輸入: k = 3, n = 9
輸出: [[1,2,6], [1,3,5], [2,3,4]]