leetcode-771-宝石与石头

leetcode 算法题 (python),从易到难,发到博客,促进自己坚持刷题!

class Solution:
    def numJewelsInStones(self, J, S):
        """
        :type J: str
        :type S: str
        :rtype: int
        """
        time = 0
        for i in J:
            for k in S:
                if i is k:
                    time+=1
        return time
                

猜你喜欢

转载自blog.csdn.net/hustwayne/article/details/83544471