Jewels and Stones Problem
Jewels and Stones Problem — ExecCode Easy DSA Practice
Solve the Jewels and Stones problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given the input needed to solve Jewels and Stones. Your task is to you're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels. Letters are case sensitive, so "a" is considered a different type of stone from "A". Return the required answer exactly as shown in the examples.
Examples
Input {"jewels": "aA", "stones": "aAAbbbb"}; Output 3. Input {"jewels": "z", "stones": "ZZ"}; Output 0
Constraints
1 <= jewels.length, stones.length <= 50 jewels and stones consist of only English letters. All the characters of jewels are unique.
Practice Jewels and Stones free on ExecCode. Browse DSA problems, topic map, and placement guides.