aboutsummaryrefslogtreecommitdiff
path: root/day02/part1
diff options
context:
space:
mode:
Diffstat (limited to 'day02/part1')
-rwxr-xr-xday02/part112
1 files changed, 12 insertions, 0 deletions
diff --git a/day02/part1 b/day02/part1
new file mode 100755
index 0000000..b63cec1
--- /dev/null
+++ b/day02/part1
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+
+cs = 0
+
+input = $stdin.readlines.map(&:chomp)
+
+input.each do |line|
+ nums = line.split.map(&:to_i)
+ cs += nums.max - nums.min
+end
+
+puts cs