Modo entrevista. Cronômetro de 4 min, sem dicas e sem autocompletar
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.
Exemplos
countJewels('aA', 'aAAbbbb')Retorna 3
countJewels('z', 'ZZ')Retorna 0
Carregando o editor...
- Entrada
countJewels('aA', 'aAAbbbb')Esperado3 - Entrada
countJewels('z', 'ZZ')Esperado0 - Entrada
countJewels('ab', 'abba')Esperado4
Os testes ocultos rodam no envio