SERIES
Dynamic Programming
The step up from the linear-DP intros in `leetcode-patterns`: unbounded choices, subsequence state, string segmentation, and sign-flipping products.
In this seriesNEWSLETTER
01
Bottom-Up DP Beats Recursion: Solving Coin Change in O(S×n)
LeetCode 322 is the textbook unbounded knapsack problem. Walk through all four approaches — brute force recursion, top-down memoization, bottom-up tabulation, and BFS — to understand exactly why the dp table works and when each version earns its place.Jun 14, 2026 · 11 min read · #00049
02
Two Ways to Find the Longest Increasing Subsequence — and Why O(n log n) Works
LeetCode 300 looks deceptively simple — find the longest strictly increasing subsequence. The O(n²) DP is the obvious first step, but the O(n log n) binary search approach is the one worth understanding deeply: it rewires how you think about subsequence state.Jun 14, 2026 · 10 min read · #00050
03
String Segmentation Is Just a DP Reachability Problem: Solving Word Break
LeetCode 139 looks like a string-matching puzzle but is really a reachability question over indices. Walk through all three approaches — brute-force recursion, top-down memoization, and bottom-up tabulation — to see exactly why the dp array works and which version holds up under real constraints.Jun 14, 2026 · 10 min read · #00051
04
Tracking Min and Max Together: Why the Product Subarray Problem Breaks Kadane's
LeetCode 152 looks identical to Maximum Subarray until a negative number shows up and flips everything. Walk through brute force and the two-lookback DP that handles sign flips — with a full trace, edge-case analysis, and the mental model you carry to future problems.Jun 14, 2026 · 8 min read · #00052
Occasional notes on what I'm building
Get an email when I publish a new post — engineering write-ups, no spam. Unsubscribe anytime.