Timer: 4 min, like in an interview. Hints and autocomplete are off while it runs
Jewels and stones
EasyMap and Set4 min
Every character of the string jewels is one kind of jewel. Every character of the string stones is one stone you have.
Write a function countJewels(jewels, stones) that counts how many of your stones are jewels. Case matters, a and A are different kinds.
Examples
countJewels('aA', 'aAAbbbb')Returns 3
countJewels('z', 'ZZ')Returns 0
Loading the editor...
- Input
countJewels('aA', 'aAAbbbb')Expected3 - Input
countJewels('z', 'ZZ')Expected0 - Input
countJewels('ab', 'abba')Expected4
Hidden tests run on Submit