Finish day 6 part 2
This commit is contained in:
parent
25d13b481c
commit
bccd6d0cb6
2 changed files with 2178 additions and 0 deletions
13
2020/day 6/P2/custom_customs.py
Normal file
13
2020/day 6/P2/custom_customs.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
qs = []
|
||||
|
||||
with open("input.txt") as f:
|
||||
for q in f.read().split("\n\n"):
|
||||
s = {}
|
||||
q = list(filter(lambda x: x, q.split("\n")))
|
||||
ln = len(q)
|
||||
for a in q:
|
||||
for le in list(a):
|
||||
s[le] = s[le] + 1 if le in s else 1
|
||||
qs.append(list(filter(lambda x: s[x] == ln, s)))
|
||||
|
||||
print(sum(map(lambda x: len(x), qs)))
|
2165
2020/day 6/P2/input.txt
Normal file
2165
2020/day 6/P2/input.txt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue