Advent of Code 2015 Day 2 Part 1
Mix.install([
{:kino_aoc, "~> 0.1"}
])
Get Inputs
{:ok, puzzle_input} =
KinoAOC.download_puzzle("2015", "2", System.fetch_env!("LB_SESSION"))
My answer
puzzle_input
|> String.split("\n")
|> Enum.map(fn row ->
[l, w, h] =
row
|> String.split("x")
|> Enum.map(&String.to_integer(&1))
{lw, wh, hl} = {l * w, w * h, h * l}
slack = Enum.min([lw, wh, hl])
2 * lw + 2 * wh + 2 * hl + slack
end)
|> Enum.sum()