Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Day 1

day1.livemd

Day 1

Mix.install([{:kino, "~> 0.5.0"}])

Part 1

input = Kino.Input.textarea("Please paste your input file:")
input
|> Kino.Input.read()
|> String.split("\n")
|> Enum.map(fn n ->
  unless n == "",
    do: String.to_integer(n)
end)
|> Enum.chunk_by(&is_integer/1)
|> Enum.reject(fn list -> list == [nil] end)
|> Enum.map(&Enum.sum/1)
|> Enum.max()