awesome-everything RU
↑ Back to the climb

Algorithms from zero

Sorting & search: interview drill

Crux Timed binary-search problems from the NeetCode-150, with progressive hints — solve each cold, then narrate the complexity.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 120 min

You understand binary search. Interviews test whether you can reach for it 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.

Five NeetCode-150 problems on the binary-search 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/5 solved

binary search

#704 Binary SearchEasy10m
Amazon
Follow-up (aloud)

Compute mid as lo + (hi - lo) // 2 rather than (lo + hi) // 2 — what bug does that avoid, and what is the loop invariant?

#74 Search a 2D MatrixMedium15m
AmazonMicrosoft
Follow-up (aloud)

Why is this O(log(m·n)) and not two separate O(log m)+O(log n) searches — and when would the two-step version be required instead?

#153 Find Minimum in Rotated Sorted ArrayMedium15m
AmazonMicrosoft
Follow-up (aloud)

Why compare against nums[hi] rather than nums[lo]? Walk through what goes wrong if you pick the wrong anchor.

#33 Search in Rotated Sorted ArrayMedium20m
AmazonMeta
Follow-up (aloud)

Confirm this stays O(log n) despite the rotation, then describe how duplicates would degrade the worst case.

#875 Koko Eating BananasMedium20m
AmazonGoogle
Follow-up (aloud)

State the complexity as O(n log m) and define n and m, then explain what makes a problem amenable to binary-search-on-answer at all.

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.

Continue the climb ↑What is recursion?
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.