Words
Current Word
-
Frequency Array (a-z)
Hash Key (tuple)
-
HashMap (frequency → words)
Empty

Word Index

-

Current Word

-

Char Scanning

-

Groups Found

0
Click "Step" or "Play" to start the visualization
Current Word
Processed
Grouped

Python Code

group = defaultdict(list)
for word in strs:
    hash = [0] * 26
    for ch in word:
        hash[ord(ch) - ord("a")] += 1
    group[tuple(hash)].append(word)
return list(group.values())