0

Possible Duplicate:
Subset sum Problem

I have an array of n elements. Find out k elements out of n whose corresponding sum is zero??

Suppose there is array of 5 elements{ 7, 5 ,-2,8 ,-5}and k=3 then the solution is 7,-2,-5. the array and k is user defined

There is recursive solution of running time O(2^k)i.e kth power of 2.

Can anyone recommend the better solution??

Community
  • 1
  • 1
Prannoy Mittal
  • 1,525
  • 5
  • 21
  • 32

0 Answers0