8 lines
191 B
JavaScript
8 lines
191 B
JavaScript
function day1(input, part2) {
|
|
return input.split("\n").num().count((e, i, a, k = a[i - (part2 ? 3 : 1)]) => k && e > k)
|
|
}
|
|
|
|
if (typeof window == "undefined") {
|
|
module.exports = day1
|
|
}
|