For today (day 10), I found that if 
    
    
    proc `-`[T](a,b: openArray[T]): seq[T]
    
    
    Run

is prepared, the solution of part 1 can be expressed in a clean way. I think it 
maybe useful in the future also.
    
    
    proc main() =
      let input = 
readFile(inputFilePath).strip.split("\n").map(parseInt).sorted()
      let diff = input[1..^1] - input[0..^2]
      echo (diff.count(1)+1) * (diff.count(3)+1)
    
    
    Run

* * *

For part 2, another hints is that {.global.} pragma is helpful to keep DP 
solution clean.

Reply via email to