19 lines
334 B
Nim
19 lines
334 B
Nim
import std/sequtils
|
|
import tools/aoc
|
|
|
|
let test: AOCDay = initAOCDay(1)
|
|
echo test.getInputInt().foldl(a + b)
|
|
|
|
var seen: seq[int]
|
|
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)
|
|
else:
|
|
echo freq
|
|
found = true
|
|
break
|