From 0c78a493d62e54244b1560409abfc0095bb5f3cc Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 16 Dec 2015 21:08:22 -0800 Subject: [PATCH] Day 17.0 --- ruby/day_17.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ruby/day_17.rb diff --git a/ruby/day_17.rb b/ruby/day_17.rb new file mode 100644 index 0000000..b96335d --- /dev/null +++ b/ruby/day_17.rb @@ -0,0 +1,23 @@ +buckets = DATA.read.split("\n").map(&:to_i) +puts (1..buckets.size).map {|i| buckets.combination(i).select {|p| p.inject(:+) == 150 }.size }.inject(:+) +__END__ +50 +44 +11 +49 +42 +46 +18 +32 +26 +40 +21 +7 +18 +43 +10 +47 +36 +24 +22 +40