Skip to content

Instantly share code, notes, and snippets.

@alexbevi
Created December 1, 2023 15:05
Show Gist options
  • Save alexbevi/6a1de4b19d6436e895ec282ec7a0bec1 to your computer and use it in GitHub Desktop.
Save alexbevi/6a1de4b19d6436e895ec282ec7a0bec1 to your computer and use it in GitHub Desktop.
# Day 1
sum = 0
File.readlines('day01.txt', chomp: true).each do |line|
sum += line.scan(/\d/).values_at(0, -1).join.to_i
end
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment