From: "ara.t.howard" Date: 2008-11-05T01:25:49+09:00 Subject: Re: Combination of numbers in an array that add up to x On Nov 4, 2008, at 8:48 AM, Hae Lee wrote: > Objective: Find list of values in an array that adds up to a specific > sum. > - > I have a list of values in an array: > [2429.63, 497.87, 51.96, 59.43, 138.4, 66.22, 28.74, 1.75, 2075.13, > 556.14, 112.56, 116.5, 84.41, 55.97, 139.07, 24.46] > > I want to find a combination among these numbers that adds up to a > total > sum of: > 3435.78 > > I was hoping a one-liner in irb would do the trick but I haven't > found a > method, etc. that will help me do this. Thoughts regarding? > -- start by installing the permutations gem (for a brute force solution). a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama