For every value in queries, return how many times it appears in nums. Return the answers in the same order as the queries.
The starter code counts again from scratch for every query. It is correct but too slow when both lists are long. Make it fast.
Example 1
Input:
count_frequencies([1, 2, 2, 3, 3, 3], [3, 2, 5])
Output:
[3, 2, 0]
Example 2
Input:
count_frequencies([], [1])
Output:
[0]
0 <= len(nums), len(queries) <= 2 * 10**5-10**9 <= value <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.