Solution for Day 09

This commit is contained in:
2020-12-09 11:05:16 +01:00
parent 08d6eb34a4
commit 89090cb0f4
3 changed files with 1038 additions and 0 deletions

13
day_09/first.rb Normal file
View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
input = File.readlines('./input').map(&:to_i)
preamble = 25
input.each_with_index do |_line, i|
next if i < preamble
unless input[i - preamble, preamble].combination(2).find { |a, b| a + b == input[i] }
puts input[i]
return
end
end