Jewels and Stones
Each character of stones is a stone you own, and each distinct character of jewels is a type of stone that counts as a jewel. Letters are case sensitive, so a and A are different types.
Return how many of your stones are jewels.
Example 1
jewels "aA"
stones "aAAbbbb"
returns 3
Three of the stones are a or A.
Example 2
jewels "z"
stones "ZZ"
returns 0
Case matters, so none match.
Constraints
0 <= len(jewels), len(stones) <= 50- Both strings have only English letters
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Hash maps problems
- Keep First of Each LetterBeginner
- Letter Count TableBeginner
- Matching Sock PairsBeginner
- Translate With a GlossaryBeginner
- Unfilled OrdersBeginner
- Check If N and Its Double ExistEasy
- Closest Pair of Equal ValuesEasy
- Consistent Code BookEasy