medium

Group Anagrams

Given a list of lowercase words, group together all words that are anagrams of each other (the same multiset of letters). Return the groups in any order.

Constraints
  • 1 ≤ strs.length ≤ 10^4
  • 0 ≤ strs[i].length ≤ 100
  • Only lowercase English letters
Examples
in: strs = ["eat","tea","tan","ate","nat","bat"]
out: [["eat","tea","ate"],["tan","nat"],["bat"]]

Code it yourself

Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?

Choose an approach to check your pattern recognition, or reveal the discussion when you need help.