Cascadiq

Group Anagrams

algorithm · Level 2 · 20 min

Description

Given an array of strings strs, group the anagrams together. An anagram is a word formed by rearranging the letters of another.

Requirements

  • Implement a function that takes strs (array of strings).
  • Return an array of groups; each group is an array of strings that are anagrams of each other.

Constraints

- `1 <= strs.length <= 10^4` - `0 <= strs[i].length <= 100` - `strs[i]` consists of lowercase English letters.

Deliverables

Return array of groups (array of arrays of strings).

Tags

ArrayHash TableString