from typing import List


def group_anagrams(strs: List[str]) -> List[List[str]]:
    """
    LeetCode 49: Group Anagrams
    Given an array of strings, group anagrams together.
    """
    str_map = {}
    res = []
    for s in strs:
        temp = ''.join(sorted(s))
        if temp not in str_map:
            str_map[temp] = len(res)
            res.append([s])
        else:
            res[str_map[temp]].append(s)
    return res