From ecff477d6eee738404a999bdce3f162354e0cfcb Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 5 Dec 2020 23:20:16 -0600 Subject: [PATCH] Part 2 for day 6 done as well --- 2020/src/day6.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/2020/src/day6.nim b/2020/src/day6.nim index 2b903c8..e94b935 100644 --- a/2020/src/day6.nim +++ b/2020/src/day6.nim @@ -1,8 +1,7 @@ import streams, sets, strutils, sequtils proc part1*(s: Stream): int = - # s.readAll().split("\n\n").mapIt(it.split("\n").foldl(a.union(b.toHashSet), initHashSet)).len s.readAll().split("\n\n").mapIt(it.split("\n").foldl(a.union(b.toHashSet), initHashSet[char]()).len).foldl(a + b) proc part2*(s: Stream): int = - 9 + s.readAll().split("\n\n").mapIt(it.split("\n").filterIt(it != "").foldl(a.intersection(b.toHashSet), "abcdefghijklmnopqrstuvwxyz".toHashSet()).len).foldl(a + b)