Group Anagrams
Group together the words of strs that are anagrams of each other (they use exactly the same letters the same number of times). Return a list of groups in any order. Inside each group, keep the words in the same order they had in strs.
Example 1
strs ["eat","tea","tan","ate","nat","bat"]
returns [["eat","tea","ate"],["tan","nat"],["bat"]]
Groups: [eat, tea, ate], [tan, nat], [bat].
Constraints
1 <= len(strs) <= 20- Words have 0 to 10 lowercase letters
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Hash maps problems
- Longest Consecutive SequenceMedium
- Longest Zero-Sum StretchMedium
- Rows That Match ColumnsMedium
- Shift FamiliesMedium
- Stretches With K Odd ValuesMedium
- Subarray Sum Equals KMedium
- Subarray Sums Divisible by KMedium
- Transfers Between AccountsMedium