This commit is contained in:
Michael Zhang 2022-11-30 23:59:44 -06:00
commit 663fb5d574
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
2 changed files with 2291 additions and 0 deletions

24
01.rb Normal file
View file

@ -0,0 +1,24 @@
contents = File.open("01.txt").read
ans1 = contents
.split("\n\n")
.map do |s|
s.split("\n")
.map(&:to_i)
.sum
end
.max
puts ans1
ans2 = contents
.split("\n\n")
.map do |s|
s.split("\n")
.map(&:to_i)
.sum
end
.sort
.last(3)
.sum
puts ans2

2267
01.txt Normal file

File diff suppressed because it is too large Load diff