Leetcode 1002. Find Common Characters

Posted 周洋的Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Leetcode 1002. Find Common Characters相关的知识,希望对你有一定的参考价值。

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

 

以上是关于Leetcode 1002. Find Common Characters的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode --- 1002. Find Common Characters 解题报告

Golang语言LeetCode 1002. Find Common Characters

LeetCode.1002-寻找共有字符(Find Common Characters)

Leetcode-1002 Find Common Characters(查找常用字符)

leetcode 1002. 查找常用字符(Find Common Characters)

[LC] 1002. Find Common Characters