[4Clojure] Problem solving record-#77

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.