Sparse Arrays

  • + 0 comments

    Python 3 Solution:

    def matchingStrings(strings, queries):
        res = []
        count = 0
        for i in range(len(queries)):
            for j in range(len(strings)):
                if strings[j] == queries[i]:
                    count += 1
            res.append(count)
            count = 0
        return res