From 9c5a2a7a539cf9408961db857a962941b0981f3c Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Fri, 25 Dec 2015 17:49:40 -0800 Subject: [PATCH] Day 24.1 --- ruby/day_24.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruby/day_24.rb b/ruby/day_24.rb index 14501a0..50f2e86 100644 --- a/ruby/day_24.rb +++ b/ruby/day_24.rb @@ -2,9 +2,9 @@ require "letters" packages = DATA.read.split("\n").map(&:to_i) total = packages.inject(:+) -weight = total/3 +weight = total/4 -(1..packages.size).each do |i| +(2..packages.size).each do |i| puts i groups = packages.combination(i).select {|combo| combo.inject(:+) == weight } unless groups.empty?