Mountain Top Programming
The fear of the LORD is the beginning of wisdom, and knowledge of the Holy One is understanding.
Monday, March 10, 2014
LeetCode: Anagrams && HashMap
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
Solution:
Use a HashMap to store sorted strings. If two strings are anagrams, they are the same after being sorted.
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment