Skip to content

Instantly share code, notes, and snippets.

@tosh tosh/day4.cljs
Created Dec 4, 2017

What would you like to do?
(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?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.