This commit is contained in:
Adam Jeniski 2023-12-06 00:35:55 -05:00
parent ff09b6d9dc
commit e1650bd8f6

View File

@ -5,26 +5,23 @@
(def input (->> (get-puzzle-input 6)))
(defn ways-to-beat [[ms record]]
(->> (range 1 ms)
(pmap #(* % (- ms %)))
(defn solve [num-str-lists]
(->> (map (partial map #(Long/parseLong %)) num-str-lists)
(apply zipmap)
(map (fn [[ms record]] (->> (range 1 ms)
(map #(* % (- ms %)))
(filter #(> % record))
(count)))
(count))))
(reduce *)))
;; part 1
(->> input
(map (partial re-seq #"\d+"))
(map (partial map #(Long/parseLong %)))
(apply zipmap)
(map ways-to-beat)
(reduce *))
solve)
;; part 2
(->> input
(map (partial re-seq #"[\s\d]+"))
(map (partial map #(string/replace % " " "")))
(map (partial map #(Long/parseLong %)))
(apply zipmap)
(map ways-to-beat)
(reduce *))
solve)