Day 6 completed, part1.py is now executable

This commit is contained in:
2024-12-01 17:57:00 +01:00
parent ae98a486a9
commit d800679291
4 changed files with 44 additions and 0 deletions

20
day6/part1.py Normal file
View File

@@ -0,0 +1,20 @@
from common import parse
def all_different_characters(input: str) -> bool:
return all(map(lambda c: input.count(c) == 1, input))
def solve(input: str) -> int:
i = 0
while i < len(input) and not all_different_characters(input[i : i + 4]):
i += 1
return i + 4
def main():
print(solve(parse("input")))
if __name__ == "__main__":
main()