def anagrams(self, strs):
# write your code here
L = [i if len(i) <= 1 else sorted(i) for i in strs]
return [strs[i] for i in range(len(L)) if L.count(L[i]) > 1]
LintCode Python 171.乱序字符串
最新推荐文章于 2022-08-16 22:44:46 发布
def anagrams(self, strs):
# write your code here
L = [i if len(i) <= 1 else sorted(i) for i in strs]
return [strs[i] for i in range(len(L)) if L.count(L[i]) > 1]