Leetcode 2671. Frequency Tracker
Design a data structure that supports add(number), deleteOne(number), and hasFrequency(f) queriesâreturning whether any value currently appears exactly f timesâunder up to 2e5 operations, so each operation must be efficient. The typical solution tracks value->count and count->number-of-values (e.g., two hash maps) to update counts and answer hasFrequency in constant time.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.