Anagrams
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
Solution: First sort all strings and build a hash map to store the positions of all duplicates (anagrams). Then check the hash map to print out all anagrams.
Note: All inputs will be in lower-case.
Solution: First sort all strings and build a hash map to store the positions of all duplicates (anagrams). Then check the hash map to print out all anagrams.
Comments
Post a Comment