Map + lambda + list comprehension = 3 Lines of Python
def anagrams(self, strs):\n        dic = defaultdict(list)\n        map(lambda item: dic[''.join(sorted(item))].append(item), strs)\n        return [x for key i
    def anagrams(self, strs):\n        dic = defaultdict(list)\n        map(lambda item: dic[''.join(sorted(item))].append(item), strs)\n        return [x for key in dic.keys() for x in dic[key] if len(dic[key]) > 1]\n\nEquivalent to:\n\n    def anagrams(self, strs):\n        dic = defaultdict(list)\n        for item in strs:\n            after = ''.join(sorted(item))\n            dic[after].append(item)\n        ans = []\n        for item in dic:\n            values = dic[item]\n            if len(values) > 1:\n                ans.extend(values)\n        return ans
[]