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