diff --git a/aoc2018.nim b/aoc2018.nim index ca7239a..7790a81 100644 --- a/aoc2018.nim +++ b/aoc2018.nim @@ -1,17 +1,18 @@ +import std/intsets import std/sequtils import tools/aoc let test: AOCDay = initAOCDay(1) echo test.getInputInt().foldl(a + b) -var seen: seq[int] +var seen: IntSet = initIntSet() var freq: int = 0 var found: bool = false while not found: for x in test.getInputInt(): freq += x if freq notin seen: - seen.add(freq) + seen.incl(freq) else: echo freq found = true