Given a collection of strings, write a function that can group the anagrams together. You can return the answer in any order.
Test collection:
["able", "bable", "bubble", "emit", "glare", "item", "large", "horse", "serve", "shore", "song", "time", "verse"]
The key idea is to group strings by a canonical signature, most commonly the sorted characters of each word or a 26-letter frequency signature. Words with the same signature are anagrams and belong in the same bucket. A hash map is the natural data structure here, giving an efficient solution for collecting all groups in one pass.