day-1
Mix.install([
{:kino, "~> 0.7.0"}
])
Section
input = Kino.Input.textarea("Input")
# the elf with the most has
input
|> Kino.Input.read()
|> String.split("\n\n")
|> Enum.map(&String.split(&1, "\n"))
|> Enum.map(fn chunk -> Enum.map(chunk, &String.to_integer/1) end)
|> Enum.map(&Enum.sum/1)
# calories
|> Enum.max()
# the three elves with the most have
input
|> Kino.Input.read()
|> String.split("\n\n")
|> Enum.map(&String.split(&1, "\n"))
|> Enum.map(fn chunk -> Enum.map(chunk, &String.to_integer/1) end)
|> Enum.map(&Enum.sum/1)
|> Enum.sort()
|> Enum.take(-3)
# calories total
|> Enum.sum()