solved part 1

master
Jeff Yates 2020-12-10 08:46:43 -05:00
parent 2e6214919d
commit e60e40ccb2
2 changed files with 22 additions and 0 deletions

11
day10/input.small Normal file
View File

@ -0,0 +1,11 @@
16
10
15
5
1
11
7
19
6
12
4

11
day10/solution1.rb Executable file
View File

@ -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(&:*)