Sparse Arrays

  • + 0 comments
    #For Python
    
    def matchingStrings(strings, queries):
        result = [0] * len(queries)
        for i in range(len(queries)):
            query = queries[i]
            for j in range(len(strings)):
                if query == strings[j]:
                    result[i] += 1
        return result