You a sequence of numbers like this one given to you as a string:
"1 2 3 4 8 11 19 33 59 154 196 260"
Create a program (any language) that calculates the smallest outcome you can't get by adding two of those numbers together.
The numbers given must be integers, and are always positive.
You can only use each number once.
The answer must be > 0 and a whole number. The given string must contain at least a 1.
Examples of invalid outcomes:
"1 2 3 4 8 11 19 33 59 154 196 260"
- 3 (1 + 2)
- 54 (19 + 33 + 8 + 2)
Example of valid outcome:
"1 2 7 34 34 78"
- 4 (1 + 2 = 3, can't get 4 by adding any numbers.)
The shortest answer wins, answers can be submitted until october 30th, 18:00 CET.
return min(set(range(sum(Input)))-map(sum(Combinations,Input)))
. \$\endgroup\$