请教一道面试题# JobHunting - 待字闺中
x*x
1 楼
Given a target number, and a series of candidate numbers, print out all
combinations, so that the sum of candidate numbers equals to the target.
Here order is not important, so don't print the duplicated combination.
e.g. target is 7, candidate is 2,3,6,7
output should be 7; or 3+2+2 (but not print 2+3+2, 2+2+3)
How to write the code to solve it? Thanks!
combinations, so that the sum of candidate numbers equals to the target.
Here order is not important, so don't print the duplicated combination.
e.g. target is 7, candidate is 2,3,6,7
output should be 7; or 3+2+2 (but not print 2+3+2, 2+2+3)
How to write the code to solve it? Thanks!