AlgoScope

Frequency Map / Hashing

Recognize it for counting, grouping, anagram and "seen before" questions.

Problem-solving patterns, pattern, beginner
3 is new and is added to the set.307112733495i
3 is new and is added to the set.307112733495i

Frequency Map: First value seen before

Decision, step 2 of 6

3 is not in the set. Add it and move on. 1 distinct so far.

Cost

Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(k)

Leads to

Topics that need this one first.