I have a set of integers $\{8, 8, 6\}$. I want to know if It is possible to get $21$ by adding a subset of them. I would like to know how is the problem called so that I can google it.
How is this problem called?
5
$\begingroup$
terminology
optimization
3 Answers
10
This is the Subset Sum Problem.
7
Your question is slightly flawed: $\{8,8,6\}$ is not a set of integers, because it contains a repetition. (Or rather, it is a set of integers, but it only contains the two elements $8$ and $6$.)
If you really did mean "set of integers", then rattle's answer is correct. If you meant "sequence of integers", as suggested by your example, then this is the Knapsack Problem. The Subset Sum Problem is a special case of the Knapsack Problem.
2
This "set" is an example of what is sometimes called a "multiset": it allows one member (in this case 8) to have multiple memberships in it rather than only one.
You can't get an odd number such as 21 by adding even numbers.