diff --git a/day10/input.small b/day10/input.small new file mode 100644 index 0000000..ec4a03f --- /dev/null +++ b/day10/input.small @@ -0,0 +1,11 @@ +16 +10 +15 +5 +1 +11 +7 +19 +6 +12 +4 diff --git a/day10/solution1.rb b/day10/solution1.rb new file mode 100755 index 0000000..aa76dc4 --- /dev/null +++ b/day10/solution1.rb @@ -0,0 +1,11 @@ +#!/bin/env ruby +require 'pry' +numbers = File.read('./input').split("\n").map(&:to_i).sort + +solution = numbers.map.with_index do |num, i| + next if i == 0 + num - numbers[i-1] +end +#binding.pry +final = [solution.count(1)+1, solution.count(3)+1] +pp final, final.reduce(&:*) \ No newline at end of file