Jewels and Stones (Leetcode 771)
Problem Link: https://leetcode.com/problems/jewels-and-stones/
class Solution:
def numJewelsInStones(self, jewels: str, stones: str) -> int:
d={}
for i in jewels:
d[i]=1
c=0
for i in stones:
if(i in d):
c+=1
return c
PreviousMaximum Length of a Concatenated String with Unique Characters (Leetcode 1239)NextGoal Parser Interpretation (Leetcode 1678)
Last updated