Modo entrevista. Temporizador de 4 min, sin pistas y sin autocompletado
Jewels and stones
FácilMap 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.
Ejemplos
countJewels('aA', 'aAAbbbb')Devuelve 3
countJewels('z', 'ZZ')Devuelve 0
Cargando el editor…
- Entrada
countJewels('aA', 'aAAbbbb')Esperado3 - Entrada
countJewels('z', 'ZZ')Esperado0 - Entrada
countJewels('ab', 'abba')Esperado4
Las pruebas ocultas se ejecutan al enviar