Hashing and maps
Overview
A hash map stores data by key-value pairs. It gives near-constant time access on average.
Problems to practice
- First non-repeating character
- Valid anagram
- Top K frequent elements
- Group anagrams
- Two-sum using map
- Subarray sum equals k
- Longest substring with K distinct characters
Key idea
Use a map when you need fast lookup, counts, or grouping.
Time and space complexity
- Put: O(1) average
- Get: O(1) average
- Delete: O(1) average
- Space: O(n)
Can you explain it without the notes?
Hashing and maps
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
What it is
Turn this concept into a clear answer.
Practice this conceptAdapted from 14_DSA_MASTER.md · “4. Hashing and maps”. Examples are study fragments; framework behavior can depend on your version.