This commit is contained in:
Adam Jeniski 2023-12-06 08:03:58 -05:00
parent c6517a9c3b
commit 720d668620

View File

@ -5,13 +5,13 @@
(def input (get-puzzle-input 6)) (def input (get-puzzle-input 6))
(defn solve [num-str-lists] (defn solve [num-str-lists] ; takes a list of list of nums-string representing time and distance
(->> (map (partial map #(Long/parseLong %)) num-str-lists) (->> (map (partial map #(Long/parseLong %)) num-str-lists)
(apply zipmap) (apply zipmap)
(map (fn [[ms record]] (->> (range 1 ms) (map (fn [[ms record]] (->> (range 1 ms)
(map #(* % (- ms %))) (map #(* % (- ms %)))
(filter #(> % record)) (filter #(> % record))
(count)))) count)))
(reduce *))) (reduce *)))
;; part 1 ;; part 1