Engineering & Guides

Coding Patterns

15 articles on coding patterns.

Two pointers on a linked list: fast and slow pointers converging on the middle node
Coding Patterns

Two Pointers on Linked Lists: Remove Nth Node, Palindrome, Reorder

The three most common two pointers linked list problems on LeetCode, explained with the offset pointer and the fast and slow pointer, plus the bugs that trip everyone up.

6 min read Jul 15, 2026Read
Three glowing paths branch from one starting node: expanding rings for BFS, a deep winding branch for DFS, and a reused grid for DP, exploring the same network
Coding Patterns

BFS vs DFS vs DP: When to Use Which to Explore a Search Space

BFS, DFS, and DP are three ways to explore a search space, not three unrelated topics. Here is a two-minute decision for which to use on any interview problem.

11 min read Jul 13, 2026Read
Sliding window vs two pointers comparison illustration
Coding Patterns

Sliding Window vs Two Pointers: Picking the Right Pattern

Sliding window vs two pointers looks like the same trick, but one tracks a contiguous region and the other a pair of endpoints. Here is the one question that tells them apart.

6 min read Jul 13, 2026Read
Dynamic Programming State and Transition Framework - Abstract visualization of connected nodes forming a DP table
Coding Patterns

Dynamic 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.

11 min read Jul 5, 2026Read
Illustration of an array being partitioned into red, white, and blue bands by low, mid, and high pointers
Coding Patterns

Dutch 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.

5 min read Jul 3, 2026Read
Linked list with a cycle and fast and slow pointers
Coding Patterns

Detect 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.

6 min read Jul 1, 2026Read
Sliding window algorithm visualization showing a glowing blue window frame moving across colorful data blocks
Coding Patterns

The 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.

12 min read Jun 28, 2026Read
Editorial illustration of dynamic programming as a small family of recurring shapes: a single row of connected cells, a two dimensional grid being filled, a triangular range being split, a small knapsack with item tokens, and a set of glowing bits, floating above a developer's desk to represent the core dynamic programming patterns.
Coding Patterns

Dynamic 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.

10 min read Jun 25, 2026Read
Editorial illustration of two software engineers sitting side by side at one glowing screen, mid-conversation, collaborating on a coding problem together. Soft speech-bubble shapes and thought lines flow between them and the code, suggesting narration and clarifying questions, with warm gold light around the shared dialogue. It represents the Microsoft coding interview as a problem-solving conversation rather than a silent test.
Coding Patterns

Microsoft 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.

9 min read Jun 24, 2026Read