diff --git a/LeetCode/0771_Jewels_and_Stones.py b/LeetCode/0771_Jewels_and_Stones.py new file mode 100644 index 0000000..f635dcc --- /dev/null +++ b/LeetCode/0771_Jewels_and_Stones.py @@ -0,0 +1,8 @@ +class Solution: + def numJewelsInStones(self, J: str, S: str) -> int: + stones = Counter(S) + count = 0 + for j in J: + if stones and j in stones: + count += stones[j] + return count