Horrible solution for day 6

This commit is contained in:
Daniel Cortés
2020-12-06 03:28:34 -03:00
parent 245e37d505
commit 1c830164a9
2 changed files with 2274 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
with open('input') as f:
data = [line.strip() for line in f.read().split('\n\n')]
def solve_a(data):
count = 0
for group in data:
answers = set()
for c in group:
if c != '\n':
answers.add(c)
count += len(answers)
return count
def solve_b(data):
count = 0
for group in data:
count_map = {}
for c in group:
if c == '\n': continue
if c in count_map:
count_map[c] += 1
else:
count_map[c] = 1
for k in count_map:
if count_map[k] == len(group.split()): count += 1
print(count_map, count, len(group.split()))
return count
print(solve_a(data))
print(solve_b(data))

2241
2020/day_6/input Normal file

File diff suppressed because it is too large Load Diff