advent-of-code/2022/python/day06.py
2022-12-09 11:43:00 -05:00

21 lines
378 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()