Common Gem Elements
Each string describes a rock’s composition, and each character represents an element found in it. The function gem_stones receives a list of strings arr. An element is considered a gem if it appears in every rock at least once. Return the number of such common characters.
Примеры
Ввод
["abcdde", "baccd", "eeabg"]Вывод
2Ввод
["abc", "abc", "abc"]Вывод
3Ввод
["ab", "cd"]Вывод
0Нужно реализовать
def gem_stones(arr: list[str]) -> int:
Теги
stringssethashmap
Prijavi se da vidiš povijest predaja
PrijavaPrijavi se da koristiš AI mentora
PrijavaTests12
Visible tests
Skriveni test 7
Skriveni test 8
Skriveni test 9
Skriveni test 10
Skriveni test 11
Skriveni test 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid