less than 1 minute read

Given a list of strings words, group all anagrams together and return the size of the largest grouping.

Constraints

  • n ≤ 5,000 where n is length of words.

https://binarysearch.com/problems/Largest-Anagram-Group

Examples

Example 1

Input

  • words = ['ab', 'ba', 'abc', 'cba', 'bca', 'ddddd']

Output

  • answer = 3

Explanation

["abc", "cba", "bca"] is the largest grouping

Solution

Leave a comment