From 9581bd568bb688d515d8c9df226088ade830454a Mon Sep 17 00:00:00 2001 From: Joshua Seigler Date: Sun, 6 Dec 2020 00:54:25 -0500 Subject: [PATCH] Use Sets --- solutions/day6/solution.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/day6/solution.js b/solutions/day6/solution.js index 362ada9..bfafa0c 100644 --- a/solutions/day6/solution.js +++ b/solutions/day6/solution.js @@ -11,7 +11,7 @@ async function run () { } function yesses (group) { - return group.replace(/\s+/gm, '').split('').reduce((acc, cur) => acc.includes(cur) ? acc : [...acc, cur], []) + return [...new Set(group.replace(/\s+/gm, '').split(''))] } async function solveForFirstStar (input) {