Write a function to categorize an array of strings into clusters, such that two strings belong to the same cluster if and only if they contain the same characters, regardless of order or frequency.
Explanation: The strings 'eat', 'tea', and 'ate' are anagrams of each other, as are 'tan' and 'nat'. The string 'bat' does not share a cluster with any other string.
Explanation: The strings 'cat' and 'tac' are anagrams, as are 'dog' and 'god'. The string 'good' does not share a cluster with any other string.
Explanation: All strings in the input array are anagrams of each other.
Group strings by character composition
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak