Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.
The same repeated number may be chosen from candidates unlimited number of times.
Note:
- All numbers (including target) will be positive integers.
- The solution set must not contain duplicate combinations.
給一個數字集合(不重複)和一個目標數字target,找到所有集合中的組合,裡面的總合等於target。
在集合中的數字可以被重複選取好幾次。
注意:
- 所有數字(包含target)都是正整數。
- 答案集合不應該包含重複的組合。
boolean
來判斷是否為重複選取的情況。call by value
須花費較多時間)。LeetCode
C++