On 12/4/05, Ryan Leavengood <leavengood / gmail.com> wrote:
[snip]
>   def sum_in_subset?(a)
>     if self < 0
>       false
>     elsif a.include?(self)
>       true
>     else
>       if a.length == 1
>         false
>       else
>         f = a.first
>         remaining = a[1..-1]
>         (self - f).sum_in_subset?(remaining) or sum_in_subset?(remaining)
>       end
>     end
>   end
> end



nice and speedy.. mine is awful and slow.

--
Simon Strandgaard