open atlas
↑ Back to track
Algorithms from zero ALG · 05 · 11

Hashing: interview drill

Timed arrays-and-hashing problems from the NeetCode-150, with progressive hints — solve each cold, then narrate the complexity.

ALG Senior ◷ 120 min
Level
FoundationsJuniorMiddleSenior

You understand hashing. Interviews test whether you can reach for a hash map under a timer, cold, and explain the cost out loud.

Goal

Solve each problem before you reveal a hint, hit the target time, and narrate the time and space complexity as if an interviewer were listening. The hints exist for when you are genuinely stuck — they nudge you toward the pattern, never the full solution.

Six NeetCode-150 problems on the arrays-and-hashing pattern this unit teaches. Set a timer, solve each cold without looking at a hint, then say the time and space complexity out loud before you move on. Reveal a hint only when you are truly stuck — the hints nudge, they never hand you the answer.

0/6 solved

arrays hashing

#1 Two SumEasy10m
AmazonGoogle
Follow-up (aloud)

Narrate why this is O(n) time and O(n) space, and what changes if the array were already sorted.

#242 Valid AnagramEasy10m
Amazon
Follow-up (aloud)

When is a fixed 26-length array strictly better than a hash map here, and how would Unicode input break that assumption?

#49 Group AnagramsMedium15m
AmazonMeta
Follow-up (aloud)

Compare the two key choices: sorting each word is O(k log k), the count signature is O(k). Why might you still prefer sorting?

#347 Top K Frequent ElementsMedium15m
AmazonMeta
Follow-up (aloud)

State the time complexity of the heap approach versus the bucket approach, and when the heap is actually the smarter choice.

#36 Valid SudokuMedium15m
Amazon
Follow-up (aloud)

Why is this O(1) time and space for a fixed 9×9 board, and how would the bound read if the board were n×n?

#128 Longest Consecutive SequenceMedium20m
AmazonGoogle
Follow-up (aloud)

Defend the O(n) claim: the inner while loop looks nested, so why is the total work still linear?

Recap

Mark each problem solved once you finished it cold, inside the target time, and could state the complexity without hesitation. Come back in a few days and re-solve the ones you marked — spaced revisits are what turn a recognised pattern into a reflex.

Something unclear?

Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.

shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.