My LeetCode grinding. Trying to do a problem a day.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213
  1. class Solution:
  2. def numJewelsInStones(self, J: str, S: str) -> int:
  3. total = 0
  4. for jewel in J:
  5. for stone in S:
  6. if stone == jewel:
  7. total += 1
  8. return total
  9. s = Solution()
  10. print("Expected: 3")
  11. print("Got:", s.numJewelsInStones("abcD", "DaaFz"))