Coding Patterns
12 articles on coding patterns.
Coding PatternsDynamic Programming Basics: State + Transition, Not Memorization
Stop memorizing DP solutions. Learn the two-step framework (state + transition) that makes any dynamic programming problem approachable, with a full Coin Change walkthrough.
Coding PatternsDutch National Flag Problem: Three-Pointer Partition and the Sort Colors Pattern
The Dutch National Flag problem (LeetCode Sort Colors 75) sorts 0s, 1s, and 2s in a single in-place pass with three pointers. Here is the intuition, the code, a trace, and the mistakes to avoid.
Coding PatternsDetect a Cycle in a Linked List: Fast and Slow Pointers
A clear guide to detecting a cycle in a linked list using Floyd's fast and slow pointer technique, with Python code and the math behind why it works.
Coding PatternsThe Sliding Window Algorithm: The Pattern That Turns O(n²) into O(n) Overnight
I avoided the sliding window pattern for months, writing nested loops that timed out on every large test case. Here's the decision framework that finally made it click, with code templates and five practice problems in order.
Coding PatternsDynamic Programming Patterns: The Core Archetypes
Most DP problems fall into a few dynamic programming patterns. Here are the five core archetypes, how to recognize each from its state, and a learning approach that sticks.
Coding PatternsMicrosoft Coding Interviews in 2026: The Problem-Solving Conversation
Microsoft coding interviews score the conversation, not just the code. The 2026 loop, why narration beats a silent solve, and how to prep for the problem-solving conversation.
Coding PatternsMemoization: Turning Recursion Into Dynamic Programming
Memoization is recursion plus a cache, and it is top-down dynamic programming. How to add it in three steps, how it compares to tabulation, and when to use each.
Coding PatternsTwo Pointers: The Pattern Inside Sorted Array Problems
The two pointer technique turns O(n²) array problems into O(n) solutions. Learn the three variations, when to use them over hash maps, and how to spot two pointer problems in interviews.
Coding PatternsDP on Trees: When Recursion Meets Dynamic Programming
Dynamic programming on trees combines recursion with memoization to solve problems like maximum path sum and house robber on tree structures. Learn the template, patterns, and rerooting technique.
