Skip to content

Instantly share code, notes, and snippets.

@stevekrouse
Created May 22, 2013 23:49
Show Gist options
  • Save stevekrouse/5631829 to your computer and use it in GitHub Desktop.
Save stevekrouse/5631829 to your computer and use it in GitHub Desktop.
object Anagrams {
def main(words: List[String]): Unit = {
words.
groupBy(word => new String[word.toCharArray.sorted]).
map(_,_2).
map(anagram => join(anagrams, ' ')).
foreach(println)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment