Created
October 6, 2024 16:31
-
-
Save mohneesh7/c65886d6f2d1fe55b70de533614af2b4 to your computer and use it in GitHub Desktop.
Solution for Jewels and Stones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def numJewelsInStones(self, jewels: str, stones: str) -> int: | |
num_jewels = 0 | |
for char in stones: | |
if char in jewels: | |
num_jewels += 1 | |
return num_jewels |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment