Created
December 1, 2018 20:07
-
-
Save kstrauser/02d82351d4901824caba3107d9ff70ed to your computer and use it in GitHub Desktop.
My solution for the December 1, 2018 Advent of Code question #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import itertools | |
import pathlib | |
value = 0 | |
seen = set() | |
for line in itertools.cycle( | |
int(line) for line in pathlib.Path("input/1.txt").read_text().splitlines() | |
): | |
value += line | |
if value in seen: | |
print(f"Saw {value} twice.") | |
break | |
seen.add(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment