Skip to content

Instantly share code, notes, and snippets.

@jhawthorn
Created December 18, 2020 05:29
Show Gist options
  • Save jhawthorn/eebff18e7384a05b9194f22cd86e10d8 to your computer and use it in GitHub Desktop.
Save jhawthorn/eebff18e7384a05b9194f22cd86e10d8 to your computer and use it in GitHub Desktop.
class Integer
alias_method :add, :+
alias_method :+, :*
alias_method :*, :add
end
p File.readlines("data/18.txt").map {
|l| eval(l.tr("+*", "*+"))
}.sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment