Problems > How Many Times Does X Appear > Editorial

How Many Times Does X Appear — Solution & Editorial

Back to the Problem

Build a frequency hash map once; each query is a lookup.

Complexity: O(N + Q)