Coding Patterns
20 articles on coding patterns.
Coding PatternsGraph 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.
Coding PatternsBFS + 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.
Coding PatternsGraph 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.
Coding PatternsAdvanced 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.
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 PatternsAmazon 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.
Coding PatternsTwo 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.
Coding PatternsBFS 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.
Coding PatternsSliding 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.
