Ctrl K
Problem

Anagram Buckets

Medium · Anagram Buckets

You are given an array of strings `words`. Two strings are anagrams when one can be turned into the other by rearranging its letters, that is, both contain the same letters the same number of times. Split the strings into groups so that every group holds strings that are anagrams of one another, and strings from different groups are not. Every element of the array, duplicates included, must land in exactly one group. Return the list of groups. The groups, and the strings inside each group, may come in any order.…

Solve the problem →