Problem :

https://leetcode.com/problems/group-anagrams


My Solution :

class Solution:
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
counter = {}
for item in strs:
key = [0]*26
for c in item:
key[ord(c)-97] += 1
counter.setdefault(tuple(key), []).append(item)
return list(counter.values())