Mode entretien. Minuteur de 4 min, sans indices ni autocomplétion
Jewels and stones
FacileMap 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.
Exemples
countJewels('aA', 'aAAbbbb')Renvoie 3
countJewels('z', 'ZZ')Renvoie 0
Chargement de l'éditeur...
- Entrée
countJewels('aA', 'aAAbbbb')Attendu3 - Entrée
countJewels('z', 'ZZ')Attendu0 - Entrée
countJewels('ab', 'abba')Attendu4
Les tests cachés se lancent à la soumission