Sobes.tech
Junior — Senior

Building groups of anagrams from a list of words

livecode

Task condition

Given a list of strings, the task is to group anagrams into separate subarrays. A word A is considered an anagram of word B if they can be obtained from each other by rearranging the characters. All elements of the input list consist only of lowercase Latin letters.

Input
['eat', 'tea', 'tan', 'ate', 'nat', 'bat']

Output
[
  ['ate', 'eat', 'tea'],
  ['nat', 'tan'],
  ['bat']
]