Level 1 · FoundationsBUILD YOUR INTUITION
HashMap
Trade a little memory for fast answers to: have I seen the value I need?
THE MENTAL MODELWhen should this come to mind?
Trade a little memory for fast answers to: have I seen the value I need?
Fast lookupFrequency countingMatching complementsGrouping values What makes it work
Expected constant-time lookup; worst-case behavior depends on the hash implementation.
When to choose something else
If sorted order or range queries are essential, consider a sorted structure.
See the pattern in action
Change the input. Follow the state. Make it yours.