You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2015/ruby/day_17.rb

26 lines
259 B

9 years ago
buckets = DATA.read.split("\n").map(&:to_i)
9 years ago
puts (1..buckets.size).flat_map {|i|
buckets.combination(i).select {|p| p.inject(:+) == 150 }
}.group_by(&:size).sort_by(&:first).first.last.size
9 years ago
__END__
50
44
11
49
42
46
18
32
26
40
21
7
18
43
10
47
36
24
22
40