Medium · Arrays & hashing

Group Anagrams

You are given a list of words. Group together the words that are anagrams of each other. Return the groups as a list of lists.

  • Words are lowercase letters only.
  • The groups can be in any order, and so can the words inside a group.
  • A word with no anagram is a group of one.
words = ["eat", "tea", "tan", "ate", "nat", "bat"]

→ [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
Record your take

No one has solved it yet.