0
$\begingroup$

I have some random integers separated by space read from a text file like

99 20 30 1 100 400 5 10 

I have to find a sum from any combination of these integers that is closest to a specifiq number like

183 

what is the fastest and accurate way of doing this?

  • 1
    I guess this is similar to the subset sum problem: http://en.wikipedia.org/wiki/Subset_sum_problem2011-01-26
  • 0
    Here is a similar question: http://stackoverflow.com/questions/2070359/finding-three-elements-in-an-array-whose-sum-is-closest-to-an-given-number2011-01-26
  • 0
    Exact copy by same person: http://stackoverflow.com/questions/4808503/series-calculation2011-01-26

2 Answers 2