My LeetCode grinding. Trying to do a problem a day.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

main.py 338B

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"))