diff options
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)) |