0

Suppose I am given a set of $N$ Natural Numbers, I have to find if it is possible to pick any $K$ numbers from the set such that the sum of the $K$ numbers equals to $S$. All $K$ numbers should be distinct.

For example,

N=5 , K=3 , S=10
One of the  ways = 5+3+2
N=5 , K=3 , S=18
No Ways
Anamaki
  • 1,002
cxzczxc
  • 53
  • 1
    You haven't shown the sets of $N$ numbers. It appears that the $N$ numbers are the set ${1,2,3\ldots N}$. Is that correct? If so, what is the minimum sum of $K$ numbers? What is the maximum sum of $K$ numbers? All totals in that range are achievable, and no others. – Ross Millikan Aug 28 '16 at 04:45
  • Is this some active homework/competition question? Someone else posted this exact question today. – gowrath Aug 28 '16 at 12:27

0 Answers0