FunctionRacerProblemsRace

Group Anagrams

MediumHash mapsPython, JavaScript, TypeScript, Java, C++

Group together the words of strs that are anagrams of each other (they use exactly the same letters the same number of times). Return a list of groups in any order. Inside each group, keep the words in the same order they had in strs.

Example 1

strs ["eat","tea","tan","ate","nat","bat"]
returns [["eat","tea","ate"],["tan","nat"],["bat"]]

Groups: [eat, tea, ate], [tan, nat], [bat].

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