Skip to content

Commit dab2c30

Browse files
feat(2020-day-06): count the questions answered by entire groups
Part 2 changed the checksum method to count the questions that everyone in a group answered, instead of questions anyone in a group answered.
1 parent 92bd9ff commit dab2c30

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

2020/day-06/solution.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path')
22
const { streamHandler } = require('./streamHandler')
3-
const { groupChecksum } = require('./questions')
3+
const { groupChecksum, groupChecksumEveryone } = require('./questions')
44

55
const filePath = path.join(__dirname, 'input.txt')
66
const answers = []
@@ -18,6 +18,10 @@ streamHandler({ filePath, processor: groupChecksum })
1818
answers.push(checksum)
1919
})
2020
.then(() => {
21-
answers.push('No answer yet')
21+
return streamHandler({ filePath, processor: groupChecksumEveryone })
22+
})
23+
.then(({ checksum }) => {
24+
console.info('Scanned all passenger answers for everyone answered')
25+
answers.push(checksum)
2226
})
2327
.then(results)

0 commit comments

Comments
 (0)