you can actually just do set(jewels) because strings are iterable
So "hashmap" is the answer to all problems. That's the message I'm getting from these shorts.
one liner: sum(s in set(jewels) for s in stones)
I think the pattern here is to use hash map whenever we solving searching problems. Some data must be indexed in order to get O(1) while searching. Correct me if i said bullshit :)
No it's different bcoz they can't accept duplicates,whereas hashmaps can
Great help
Bro see constraints : they already mentioned "all the characters of jewels are unique .
for me, thats not a mistake, thats an inefficient solution.
@GregHogg