My LeetCode grinding. Trying to do a problem a day.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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