Notice Period

Anagram Cliques

medium

Given a list of lowercase words, gather them into groups where every word in a group is an anagram of the others.

Return the groups as a list of lists. Order of groups and order within groups don't matter.

Example 1
in words = ["eat","tea","tan","ate","nat","bat"]
out [["eat","tea","ate"],["tan","nat"],["bat"]]
Example 2
in words = ["x"]
out [["x"]]
Constraints
  • · 1 <= len(words) <= 10^4
  • · 0 <= len(words[i]) <= 100
  • · lowercase English letters
similar problem on LeetCode ↗
solution.pyloading python…
test results
Hit ▶ Run to test your code against the visible cases.