Skip to content

Commit

Permalink
d3
Browse files Browse the repository at this point in the history
  • Loading branch information
anishthite committed Dec 4, 2021
1 parent af2e524 commit 7fe5664
Show file tree
Hide file tree
Showing 3 changed files with 1,154 additions and 0 deletions.
12 changes: 12 additions & 0 deletions day3/aoct.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from collections import Counter
d = Counter()
f = open('input.txt').readlines()
for b in f:
for i, c in enumerate(b.rstrip()):
if c == '1':
d[i] +=1
else:
d[i] -=1
e = ''.join(['1' if d[i] > 0 else '0' for i in range(12)])
g = ''.join(['0' if i == '1' else '1' for i in e ])
print(int(e, 2) * int(g,2))
Loading

0 comments on commit 7fe5664

Please sign in to comment.