From 720d668620a288eb93acd29762013c5641c61243 Mon Sep 17 00:00:00 2001 From: Adam Jeniski Date: Wed, 6 Dec 2023 08:03:58 -0500 Subject: [PATCH] golf --- 2023/src/day06.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2023/src/day06.clj b/2023/src/day06.clj index ae20411..07b0376 100644 --- a/2023/src/day06.clj +++ b/2023/src/day06.clj @@ -5,13 +5,13 @@ (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) (apply zipmap) (map (fn [[ms record]] (->> (range 1 ms) (map #(* % (- ms %))) (filter #(> % record)) - (count)))) + count))) (reduce *))) ;; part 1