Hello everyone how i can sum a number (n) from array with at leaset specfic number (k) in JAVA .
like e.x ) n= 18 , k= 2
18 = 7 + 11 . array[2, 3, 5, 7, 11, 13, 17, 19, 23] ............................................... e.x) n = 11 , k= 3 11= 5 + 4 + 2 .
array[2, 3, 5, 4, 11, 13, 6, 19, 23]
sgtlaugh can you help me :)
I'm sorry, I really can't comprehend what you're trying to say.
how i can sum a number from an array
check this :
n=5
array contain (1,4,2,2) :
the element = 1+4 ==5
how i can get these (1,4) ?
You can use dynamic programming. Google for dynamic programming knapsack print solution.