init 2017

This commit is contained in:
Adam Jeniski
2026-04-23 15:36:25 -04:00
parent 7057247936
commit 484e507af1
6 changed files with 101 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
(ns day01
(:require input-manager))
(defn to-digit [c] (Character/digit c 10))
(def input (mapv to-digit (input-manager/get-input-raw 2017 01)))
(defn solve [offset]
(let [lookup (fn [idx]
(input (mod idx (count input))))]
(->> input
(map-indexed vector)
(filter (fn [[idx el]]
(= el (lookup (+ offset idx)))))
(map second)
(apply +))))
;; part 1
(solve 1)
;; part 2
(solve (/ (count input) 2))