Solution: Group Anagrams
Let's solve the Group Anagrams problem using the Knowing What to Track pattern.
Statement
Given a list of words or phrases, group the words that are anagrams of each other. An anagram is a word or phrase formed from another word by rearranging its letters.
Constraints:
Let strs
be the list of strings given as input to find the anagrams.
-
strs.length
-
strs[i].length
strs[i]
consists of lowercase English letters.
Note: The order in which the output is displayed doesn’t matter.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.