FunctionRacerProblemsRace

Jewels and Stones

BeginnerHash mapsPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems