diff --git a/2020/day6/day6.js b/2020/day6/day6.js index 81a097f..8d25017 100755 --- a/2020/day6/day6.js +++ b/2020/day6/day6.js @@ -18,10 +18,10 @@ fs.readFile('input.txt', (err, data) => { for (const question of person) { if (q1Questions.indexOf(question) < 0) { q1Questions.push(question); + } - if (group.every(person => person.indexOf(question) >= 0)) { - q2Questions.push(question); - } + if (q2Questions.indexOf(question) < 0 && group.every(person => person.indexOf(question) >= 0)) { + q2Questions.push(question); } } }