Instantly share code, notes, and snippets.

Embed
What would you like to do?
advent-of-code-2017-day4.cljs
(defn input [r]
(->> (.split r "\n")
(map #(.trim %))
(map #(.split % " "))))
(defn anagram? [a b]
(= (frequencies a)
(frequencies b)))
(defn valid? [passphrase]
(= (count passphrase)
(count (set passphrase))))
(defn valid2? [passphrase]
(let [frs (map frequencies passphrase)]
(= (count (distinct frs))
(count frs))))
(defn solve []
(->> (input raw-input)
(filter valid2?)
count))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment