advent-of-code/2022/python/day06.py
2022-12-12 02:41:14 -05:00

24 lines
377 B
Python

from shared import load_rows
def part1(row, group_size=4):
for x in range(len(row)):
if len(set(row[x : x + group_size])) == group_size:
print(x + group_size)
break
def part2(row):
part1(row, 14)
def main():
rows = load_rows(6)
for row in rows:
part1(row)
part2(row)
if __name__ == "__main__":
main()