franz newline
This commit is contained in:
parent
f88a28cad2
commit
d55ca4c019
@ -7,14 +7,11 @@
|
|||||||
(partial re-seq #"[a-z]{3}")))
|
(partial re-seq #"[a-z]{3}")))
|
||||||
(into {})))
|
(into {})))
|
||||||
|
|
||||||
(def count-paths
|
(def count-paths (memoize (fn [start target]
|
||||||
(memoize
|
(let [edges (input start)]
|
||||||
(fn [start target]
|
(if (contains? edges target)
|
||||||
(let [edges (input start)]
|
1
|
||||||
(if (contains? edges target)
|
(apply + (map #(count-paths % target) edges)))))))
|
||||||
1
|
|
||||||
(apply + (map #(count-paths % target) edges)))))))
|
|
||||||
|
|
||||||
|
|
||||||
;; part 1
|
;; part 1
|
||||||
(count-paths "you" "out")
|
(count-paths "you" "out")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user