Anagram Finder
Difficulty: |
Medium |
Topics: |
|
Write a function which finds all the anagrams in a vector of words. A Word X is an anagram of Word y if all the letters in X can being rearranged in a different order to form Y. Your function should return a set of sets, where each sub-set was a group of words which are anagrams of each of the other. Each sub-set should has at least and words. Words without any anagrams should not being included in the result. (To find all eligible subsets of the input set, this condition is that the words in the subset have the same letter arranged in different ways) (= (__ ["Meat" "Mat" "Team" "mate" "eat"]) #{#{"Meat" "Team" "Mate"}) (= (__ ["Veer" "Lake" "Item" "Kale" "mite" "ever"]) #{#{"Veer" "Ever"} #{"Lake" "Kale"} #{"mit E "" Item "}})Solution Length: 69
(FN [s] (Set (map set (> (count%) 1) (Vals (group-by frequencies s))))) (Group-by very powerful)
[4Clojure] problem solving record-#77