02: I Was Told There Would Be No Math
Part 1
Part 2
tmp <- dt %>%
.[, c("l", "w", "h") := .(V1 * V2, V2 * V3, V1 * V3)]
tmp <- tmp[, c("l", "w", "h") := .(V1, V2, V3)] %>%
.[, max := apply(dt[, .(l, w, h)], 1, max)] %>%
rowwise() %>%
mutate(test = list(c(l, w, h)))
tmp$min1 <- t(data.frame(sapply(tmp$test, sort)))[,1]
tmp$min2 <- t(data.frame(sapply(tmp$test, sort)))[,2]
tmp <- data.table::data.table(tmp)[,rib := ((2*min1 + 2*min2) + (V1 * V2 * V3))]
sum(tmp$rib, na.rm = TRUE)
[1] 3812909