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.

Comments

Popular posts from this blog

Maximum Gap

Binary Tree Maximum Path Sum

[ITint5] Maximum Subarray for a Circular Array