1
0
Fork 0
advent-of-code-2024/1-2.rb

13 lines
230 B
Ruby
Raw Normal View History

2024-12-01 16:21:27 -05:00
#!/usr/bin/env ruby
input = File.readlines("1.input").map(&:split)
first = input.map(&:first).compact
last = input.map(&:last).compact
result = first.map do |v|
v.to_i * last.select { _1.match?(v) }.size
end.sum
puts result