Skip to content

Instantly share code, notes, and snippets.

@windmaomao
Last active September 26, 2020 13:09
Show Gist options
  • Save windmaomao/71bfa52e79cfbb6ff0571001eacf1985 to your computer and use it in GitHub Desktop.
Save windmaomao/71bfa52e79cfbb6ff0571001eacf1985 to your computer and use it in GitHub Desktop.
// aoc2015-d2-part1.kt
val paper = { l: Int, w: Int, h: Int ->
(l * w + w * h + h * l) * 2 +
l * w * h / maxOf(l, w, h)
}
fun part1(list: List<Box>) = list
.map { (l, w, h) -> paper(l, w, h) }
.sum()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment