Leetcode 49 Posted on 2019-04-20 | | 阅读数 Words count in article: 50 | Reading time ≈ 1 Question Solution如果已经存在了,直接修改对应key的value 1234567class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: d = {} for w in strs: key = tuple(sorted(w)) d[key] = d.get(key, []) + [w] return list(d.values())