Combination Sum I(可重复取)
Given a set of candidate numbers (C) and a target number (T), find all unique combinations inC_where the candidate numbers sums toT_.
Thesamerepeated number may be chosen from_C_unlimited number of times.
Example
Given candidate set[2,3,6,7]
and target7
, a solution set is:
Notice
分析:
单数可重复取问题
要去重,用set。
要排序为了后面target<num[i]可以直接返回,因为后面更大无需比了。
Last updated
Was this helpful?