1
0
Fork 0
advent-of-code-2024/03/3-1.rb

12 lines
195 B
Ruby
Raw Permalink Normal View History

2024-12-03 09:43:05 -05:00
#!/usr/bin/env ruby
problem = 3
input = File.readlines("#{problem}.input").join
result = input
.scan(/mul\((\d{1,3}),(\d{1,3})\)/)
.map { _1.map(&:to_i).inject(1, :*) }
.sum
puts result