Created
December 1, 2020 22:53
-
-
Save dropkickfish/a67762027fe628b0a81a2f593c634858 to your computer and use it in GitHub Desktop.
Advent of Code 2020 Day 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [] | |
File.foreach("input1.txt") { |line| array << line.to_i } | |
pairs = array.combination(ARGV[0].to_i) | |
pairs.each do |pair| | |
if pair.sum == 2020 | |
puts pair[0..-1].reduce(:*) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment