Frequency Map / Hashing
Recognize it for counting, grouping, anagram and "seen before" questions.
Decision · step 2 of 6Frequency Map: First value seen before
3 is not in the set. Add it and move on. 1 distinct so far.
What you will see
A count table beside the data; each element bumps its count.
Cost
| Best | O(n) |
|---|---|
| Average | O(n) |
| Worst | O(n) |
| Space | O(k) |
How you work with it here
play it through, step one change at a time, run it on your own input, predict what happens next.
Screen readers: Pattern lessons reuse the canonical algorithm's semantics and add a spoken "recognize this when" cue.
Reduced motion: Inherits the canonical algorithm's strategy.