python可重集合操作
class Solution(object): def commonChars(self, A): """ :type A: List[str] :rtype: List[str] """ if not A: return [] from collections import Counter ans=Counter(A[0]) for str in A: ans&=Counter(str) ans=list(ans.elements()) return ans
原文地址:https://www.cnblogs.com/zywscq/p/10513632.html
时间: 2025-01-10 16:33:57