AdventOfCode2020/day_1/task_1.js

11 lines
323 B
JavaScript
Raw Permalink Normal View History

2020-12-01 14:37:36 +00:00
const fs = require('fs');
2020-12-05 10:35:52 +00:00
const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8');
2020-12-01 14:37:36 +00:00
const arr = file.split('\n');
arr.forEach(num => {
arr.forEach(num2 => {
if (Number(num) + Number(num2) == 2020) {
console.log(`Found match: ${num} + ${num2} (${num * num2})`);
}
});
});