Skip to content

Instantly share code, notes, and snippets.

@timbogit
Created February 10, 2015 03:52
Show Gist options
  • Save timbogit/b41e92092620f6d927dc to your computer and use it in GitHub Desktop.
Save timbogit/b41e92092620f6d927dc to your computer and use it in GitHub Desktop.
Solution to Problem 73
#(first (reduce-kv
(fn [res k v]
(if (or
(clojure.set/subset? #{0 1 2} v)
(clojure.set/subset? #{3 4 5} v)
(clojure.set/subset? #{6 7 8} v)
(clojure.set/subset? #{0 3 6} v)
(clojure.set/subset? #{1 4 7} v)
(clojure.set/subset? #{2 5 8} v)
(clojure.set/subset? #{0 4 8} v)
(clojure.set/subset? #{2 4 6} v))
(conj res k)
res))
'()
(reduce-kv
(fn [m k v]
(assoc m k (set (map first v))))
{}
(dissoc (group-by second (map-indexed list (flatten %))) :e))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment