FunctionRacerProblemsRace

Largest Anagram Family

EasyHash mapsPython, JavaScript, TypeScript, Java, C++

Two words are anagrams when one can be rearranged into the other: they use the same letters with the same counts. Split words into families so that any two words of a family are anagrams of each other, and return the number of words in the largest family.

Identical words are anagrams of each other, and every copy counts. The empty list gives 0.

Example 1

words ["listen","silent","google","enlist","tinsel"]
returns 4

listen, silent, enlist and tinsel are all anagrams of each other: a family of 4. google is alone.

Example 2

words ["cat","dog","bird"]
returns 1

No two words share the same letters, so every family has one word.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems