This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KENAI PENINSULA|AK: 203500 | |
ANCHORAGE|AK: 295800 | |
FAIRBANKS NORTH STAR|AK: 218200 | |
JUNEAU|AK: 335700 | |
KETCHIKAN GATEWAY|AK: 210500 | |
KODIAK ISLAND|AK: 272900 | |
JEFFERSON|AL: 130647 | |
SHELBY|AL: 203576 | |
TALLAPOOSA|AL: 108800 | |
LAUDERDALE|AL: 116650 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [s rank] | |
(let [n (count s) step (reduce * (range 1 n))] | |
(loop [i 0 s (sort s) acc '() r rank step step] | |
(let [index (quot r step)] | |
(if (= 1 (count s)) | |
(clojure.string/join (concat acc s)) | |
(recur (inc i) | |
(concat (take index s) (drop (inc index) s)) | |
(concat acc [(nth s index)]) | |
(- r (* index step)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn primeFactors | |
([n] (primeFactors n 2)) | |
([n div] | |
(cond | |
(< n div) '() | |
(zero? (mod n div)) (cons div (lazy-seq (primeFactors (/ n div) div))) | |
:else (recur n (inc div))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [o] | |
(let [f (fn q [s o c] | |
(set(remove #(or (coll? %) (nil? %)) | |
(tree-seq | |
coll? | |
seq | |
(let[j (fn [sep coll] (clojure.string/join sep coll)) | |
a (if (pos? o) (q (concat s "(") (dec o) (inc c))) | |
b (if (pos? c) (q (concat s ")") o (dec c)))] | |
(if (and (zero? o) (zero? c)) |