Algorithm · Amazon · Medium
Implement groupAnagrams(words). The argument words is an array of strings. Collect the strings into groups so that any two strings sharing a group are anagrams of each other, and return the list of all such groups. Two strings count as anagrams when each lowercase English letter appears exactly as many times in the first string as it does in the second. Neither the ordering of the groups in the result nor the ordering of strings inside any one group is significant; any…