AdventOfCode2020/day_1/task_2.js

13 lines
398 B
JavaScript
Raw Normal View History

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