1. 程式人生 > >leetcode-771-寶石與石頭

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