solved day 1

main
s00ner 2022-12-02 11:31:44 -05:00
parent d12c935f9d
commit 9bf6b898db
2 changed files with 2275 additions and 0 deletions

2250
day01/input Normal file

File diff suppressed because it is too large Load Diff

25
day01/solution.rb Normal file
View File

@ -0,0 +1,25 @@
#!/bin/env ruby
require 'pry'
elves = File.readlines('./input').map(&:strip)
totals = []
count = 0
elves.each do |calories|
if calories.empty?
totals.push(count)
count = 0
else
count += calories.to_i
end
end
puts "Part 1 Solution: #{totals.max}"
top_three = 0
3.times do
top_three += totals.delete(totals.max)
end
puts "Part 2 SOlution: #{top_three}"
# binding.pry