Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
Idea:
- Put the array of String(convert to char) into a queue
- Merge sort all of the item in the queue
- Use a Hashtable, put sorted string as key, Stack as value (which has a stack of original string)
- Iterate the Hashtable, Iterate stack which size is greater than, put the String into ArrayList from that stack
No comments :
Post a Comment