• + 0 comments

    Python: allocate extra space for linear runtime

    from collections import Counter
    
    def matchingStrings(stringList, queries):
        # Write your code here
        counts = Counter(stringList)
        return [counts[query] for query in queries]