Skip to content

Instantly share code, notes, and snippets.

@windmaomao
Created September 19, 2020 13:42
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/d0834c9993e528faa9f80f5468d9e8d9 to your computer and use it in GitHub Desktop.
Save windmaomao/d0834c9993e528faa9f80f5468d9e8d9 to your computer and use it in GitHub Desktop.
// aoc2015-day2-part.kt
fun part(
list: List<Box>,
fn: (Int, Int, Int) -> Int
) = list
.map { (l, w, h) -> fn(l, w, h) }
.sum()
fun part1(list: List<Box>) = part(list, paper)
fun part2(list: List<Box>) = part(list, paper2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment