You are viewing a single comment's thread. Return to all comments →
I notice alot of these solutions process 2x. an easy way is to just use Counter and collect values that have keys in the counter.
result = 
c = Counter(strings)
for q in queries:
c[q] ? result.append(c[q]) : result.append(0)