LESSON 04 / 75·2 min readFoundation

Hashing and maps

Must knowConcept lesson
01 Understand02 Recall03 Prepare

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)

PAUSE & RECALL

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

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Linked list

Adapted from 14_DSA_MASTER.md · “4. Hashing and maps”. Examples are study fragments; framework behavior can depend on your version.