Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 595 Bytes

40-Combination-Sum-II.md

File metadata and controls

29 lines (26 loc) · 595 Bytes

Combination Sum II

给定一个 (无重复的) 候选数字 (候选者) 集合和一个目标数字 (目标值), 在候选着中找到所有唯一的组合, 其候选数字的和等于目标值
候选者中的数字在组合中仅能使用一次

注意

  • 所有数字 (包括目标值) 都是正整数
  • 解答集不能包含重复的组合

示例 1:

输入: candidates = [10,1,2,7,6,1,5], target = 8,
解答集是:
[
  [1, 7],
  [1, 2, 5],
  [2, 6],
  [1, 1, 6]
]

示例 2:

输入: candidates = [2,5,2,1,2], target = 5,
解答集是:
[
  [1,2,2],
  [5]
]