get list of anagrams from a dictionary

后端 未结 5 778
生来不讨喜
生来不讨喜 2020-12-01 19:58

Basically, Anagrams are like permutation of string.E.g stack ,sackt ,stakc all are anagrams of stack (thought above words

5条回答
  •  猫巷女王i
    2020-12-01 20:43

    Use a hashmap with string as key and list(string) as value where list of strings contain all anagrams of a key string.

    The question is similar to "find all anagrams of a word in a file"

    View algo and code here http://justprogrammng.blogspot.com/2012/06/determine-anagrams-of-word-in-file.html

提交回复
热议问题