Engineering & Guides

Coding Patterns

20 articles on coding patterns.

Graph traversal algorithms cover: BFS, DFS, and how to choose
Coding Patterns

Graph Traversal Algorithms: BFS, DFS, and How to Choose

Compare the core graph traversal algorithms: how BFS and DFS work, what they cost, the variants that matter, and a simple framework for choosing the right one under pressure.

8 min read Aug 6, 2026Read
BFS shortest path algorithm with binary search: a monotonic feasibility strip flipping from no to yes marks the answer threshold
Coding Patterns

BFS + Binary Search: the Shortest Path When a Threshold, not Distance, Matters

Plain BFS finds the fewest steps, but some path problems minimize the largest jump instead. Here is how BFS plus binary search on the answer solves them, with a Python template.

7 min read Aug 5, 2026Read
Grid of cells morphing into a node and edge graph
Coding Patterns

Graph Traversal on a Grid: Matrix Problems in Disguise

Islands, rotting oranges, maze escapes: every grid question is graph traversal with the edges left implicit. Here is the translation, in both directions.

11 min read Jul 20, 2026Read
Advanced BFS graph traversal: multi-source waves and two search frontiers meeting in the middle
Coding Patterns

Advanced BFS: Multi-Source, Stateful, and Bidirectional

Plain BFS is only the warm-up. Here are the three variations interviews actually test: multi source BFS, stateful BFS, and bidirectional BFS, with Python and a decision guide.

11 min read Jul 19, 2026Read
Two Pointers pattern illustration showing two arrow cursors on a sorted array
Coding Patterns

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

11 min read Jul 19, 2026Read
Editorial illustration of an engineer narrating an algorithm at a whiteboard while speech bubbles and evaluation cards drift toward a calm interviewer taking notes, in a deep navy and teal palette, representing an Amazon coding interview where communication matters as much as the code.
Coding Patterns

Amazon Coding Interview Prep 2026: Leadership Principles in Your Algorithm Explanation

At Amazon, your algorithm gets you in the room, but how you narrate it decides the offer. A practical guide to weaving the Leadership Principles into how you explain your code.

11 min read Jul 18, 2026Read
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