class Solution(object):
    def numJewelsInStones(self, J, S):
        """
        :type J: str
        :type S: str
        :rtype: int
        """
        count=collections.Counter(S)
        ans=0
        for j in J:
            ans+=count.get(j,0)
        return ans

 

相关文章:

  • 2022-01-26
  • 2021-10-26
  • 2022-12-23
猜你喜欢
  • 2021-11-27
  • 2021-06-15
  • 2021-10-30
  • 2021-09-17
  • 2022-12-23
相关资源
相似解决方案