Day 10p1?
This commit is contained in:
parent
3e89255cdb
commit
014890191a
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue