Backtracking recursion question
There is a bag that can take X kilogram. You will get an array of stuff and their weight. Print true and the each weight of the stuff and false if there is 开发者_开发百科no answer
Example:
for X=20
array {4,9,1,15,7,12,3}
print true and 4 1 15 (4+1+15=20)
This is a variation of subset sum problem.
You can find some guidelines of approaching this using backtracking here.
精彩评论