// TOPIC
#techniques
4 articles
◆◆IntermediateAmazonGoogle
01Prefix Sums
Precompute running totals so any range sum becomes one subtraction. The prefix sum technique turns O(n) per query into O(1) — and the hashmap combo unlocks a whole class of subarray counting problems.
#arrays#prefix-sums#techniques
10 min◆◆IntermediateAmazonGoogle
02Monotonic Stacks
Master the monotonic stack — the O(n) pop-while trick behind next greater element, Daily Temperatures, Largest Rectangle, and Trapping Rain Water.
#monotonic-stack#stack#arrays
14 min◆◆IntermediateGoogleAmazon
03Greedy Algorithms
Greedy algorithms commit to the locally optimal choice and never backtrack. Learn when that beats DP cold and when it quietly hands you the wrong answer.
#greedy#algorithms#techniques
12 min◆◆IntermediateGoogleAmazon
04Binary Search (Beyond the Sorted Array)
Master the binary search algorithm once and for all — the invariant that kills off-by-one bugs, and the "search on the answer" trick that works on problems that don't look like binary search at all.
#binary-search#searching#techniques
12 min