Day 10p1?

This commit is contained in:
Daniel Flanagan 2020-12-10 01:08:23 -06:00
parent 3e89255cdb
commit 014890191a
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -1,7 +1,16 @@
import streams import streams, input_helpers, algorithm, sequtils
proc part1*(s: Stream): int = proc part1*(s: Stream): int =
0 var d1 = 0
var d3 = 1
var nums = @[0].concat(toSeq(s.asInts).sorted)
for i in 1..<nums.len:
case nums[i] - nums[i-1]:
of 1: inc d1
of 3: inc d3
else: discard
d1 * d3
proc part2*(s: Stream): int = proc part2*(s: Stream): int =
0 0