mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 09:23:17 -09:00
golf
This commit is contained in:
parent
c6517a9c3b
commit
720d668620
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user