diff options
author | 2020-12-15 20:58:10 +0100 | |
---|---|---|
committer | 2020-12-15 20:58:10 +0100 | |
commit | 230a46e148029b2014201616c06023b63043961d (patch) | |
tree | eecb64ac55d93771ebe038a49c2c38117ca7e00a /day1/day1-1.js | |
parent | 6eb86da5efc99e63c58f1fc9a1f7e3706dd6a2dc (diff) | |
download | advent_of_code_2020-230a46e148029b2014201616c06023b63043961d.tar.gz advent_of_code_2020-230a46e148029b2014201616c06023b63043961d.tar.bz2 advent_of_code_2020-230a46e148029b2014201616c06023b63043961d.zip |
day1
Diffstat (limited to 'day1/day1-1.js')
-rw-r--r-- | day1/day1-1.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/day1/day1-1.js b/day1/day1-1.js new file mode 100644 index 0000000..8334d9d --- /dev/null +++ b/day1/day1-1.js @@ -0,0 +1,4 @@ +const data = require('./data') +const numbers = data.split(/\n/).filter(d => d).map(d => parseInt(d)) +const number = numbers.find(n => numbers.some(num => n + num === 2020)) +console.log('Answer: ', number * (2020 - number)) |