Part 1 | Part 2 | Total | |
---|---|---|---|
Time | 3:03 | 0:58 | 4:01 |
First place for both parts in NJIT ACM!
import aocd
with open("sess") as f:
sess = f.readline()
din = aocd.get_data(session=sess, year=2022, day=6)
din = din.split("\n")
ans = 0
for line in din:
### SECTION TO MODIFY FOR Part 2
for i in range(3, len(line)+1):
check = line[i-4:i]
if len(set([char for char in check])) == 4:
### END SECTION
ans = i
break
aocd.submit(answer=ans, session=sess, year=2022, day=6)
Very small modification to change the length of markers to look for (from 4 to 14).
for i in range(13, len(line)+1):
check = line[i-14:i]
if len(set([char for char in check])) == 14: