mirror of
https://github.com/Crocmagnon/advent-of-code.git
synced 2024-12-22 05:41:51 +01:00
Solve day 1 part 2
This commit is contained in:
parent
8307409c2c
commit
21272f7281
1 changed files with 1 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
let total = 0;
|
||||
$("pre").innerText.trim().split("\n").map(el => Number(el)).reduce((prev, current) => {if (prev < current) {total += 1} return current});
|
||||
$("pre").innerText.trim().split("\n").map(el => Number(el)).map((el, index, array) => el + array[index+1] + array[index+2]).reduce((prev, current) => {if (prev < current) {total += 1} return current});
|
||||
console.log(total);
|
||||
|
||||
|
|
Loading…
Reference in a new issue