adventofcode-2020/05/part2

14 lines
355 B
Plaintext
Raw Normal View History

2020-12-13 15:50:56 +01:00
#!/usr/bin/python3
occupied = set()
with open("input") as fh:
for ln in fh:
s = ln.strip()
bin = s.replace("F", "0").replace("B", "1").replace("L", "0").replace("R", "1")
num = int(bin, base=2)
occupied.add(num)
for i in range(1024):
if i not in occupied and i-1 in occupied and i+1 in occupied:
print(i)