You are viewing a single comment's thread. Return to all comments →
One liner with list comprehensions and no aux/temp variables:
def matchingStrings(strings, queries): return [ sum(int(q == s) for s in strings) for q in queries ]
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
One liner with list comprehensions and no aux/temp variables: