Search
⌘K

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.

Comments

Your account is free and you can post anonymously if you choose.