Compare commits

..

No commits in common. "9e57a7dffb6508ea5237c7d9e43f42cf2ced07c0" and "f70ba6d543b6126df48e7f9896dfef8e222e59a6" have entirely different histories.

View File

@ -5,6 +5,7 @@
(mapv (comp (partial mapv parse-long)
(partial re-seq #"\d+")))))
(def initial-circuits (into #{} (map hash-set input)))
(defn square [x] (* x x))
(defn dist-squared [[ax ay az] [bx by bz]]
(+ (square (- ax bx))
@ -26,7 +27,10 @@
(if (= circuit-a circuit-b)
circuits
(let [combined (clojure.set/union circuit-a circuit-b)]
(-> circuits (disj circuit-a) (disj circuit-b) (conj combined))))))
(-> circuits
(disj circuit-a)
(disj circuit-b)
(conj combined))))))
initial-circuits)
(sort-by count)
(take-last 3)