Algorithms from zero
Toolbox: technique-selection review
The whole track collapses into one skill: read a problem and name the right tool before you write a line. Each question hands you a problem statement and asks not ‘what is the answer’ but ‘which technique, and why that one over the tempting wrong one’.
Confirm you can map a problem’s shape — its constraints, its structure, what it asks — onto the technique that fits, and explain why the obvious alternative fails or wastes time.
You are given an unsorted array of 10^6 integers and must answer 10^5 queries of the form 'does value X exist?'. Which approach, and why?
A problem asks for the number of distinct ways to make change for amount N using given coin denominations. N is up to 10^4. Which technique, and what is the tell?
You must find the k smallest elements of a stream of n numbers (n unknown in advance, k fixed and small). Which data structure carries the technique?
Given a sorted array, find two indices whose values sum to a target. The array can be huge and you must use O(1) extra space. Which technique?
You must detect whether a directed dependency graph has a cycle, and if not, produce a valid build order. Which technique?
A problem gives n <= 20 items and asks for the optimal subset under a constraint that resists any greedy or DP-by-value formulation. The constraints scream a particular family. Which, and what is the n <= 20 tell?
Technique selection is reading, not recall. Constraint sizes are the loudest signal: n ≤ 20 licenses 2^n enumeration; n ≤ 10^5 demands O(n log n); 10^9 forces O(log n) or math. The problem’s verb picks the family — does it exist maps to hashing; k smallest or next priority maps to a heap; ways to count or optimise over overlapping subproblems maps to DP; best local choice you can prove maps to greedy; order by dependency maps to toposort; pair in sorted data with O(1) space maps to two pointers. Every wrong answer above is a real tool misapplied — the skill is matching shape to tool, then knowing why the tempting alternative wastes time or breaks.