Skip to content

Instantly share code, notes, and snippets.

@windmaomao
Last active September 21, 2020 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save windmaomao/fd95070dcbc59a36574178ef7d8d2836 to your computer and use it in GitHub Desktop.
Save windmaomao/fd95070dcbc59a36574178ef7d8d2836 to your computer and use it in GitHub Desktop.
// aoc2015-d2-part2.kt
val paper2 = { l: Int, w: Int, h: Int ->
val m = maxOf(l, w, h)
(l + w + h - m) * 2 + l * w * h
}
fun part2(list: List<Box>) = list
.map { (l, w, h) -> paper2(l, w, h) }
.sum()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment