难度:容易
1. Description
171. 乱序字符串
2. Solution
- python3
class Solution:
"""
@param strs: A list of strings
@return: A list of strings
"""
def anagrams(self, strs):
# write your code here
ht = dict()
for word in strs:
s =''.join(sorted(word))
ht[s] = [word] if s not in ht else ht[s]+[word]
res = []
for key in ht.keys():
if len(ht[key])>=2:
res+=ht[key]
return res