aboutsummaryrefslogtreecommitdiff
path: root/day08/part1
diff options
context:
space:
mode:
Diffstat (limited to 'day08/part1')
-rwxr-xr-xday08/part112
1 files changed, 12 insertions, 0 deletions
diff --git a/day08/part1 b/day08/part1
new file mode 100755
index 0000000..5936286
--- /dev/null
+++ b/day08/part1
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+
+W = 25
+T = 6
+
+input = $stdin.readlines[0].strip.chars.map(&:to_i)
+
+layers = input.each_slice(W * T).to_a
+
+zeroest = layers.sort{ |a,b| a.count(0) <=> b.count(0) }.first
+
+puts zeroest.count(1) * zeroest.count(2)