Deep dives into algorithm patterns like sliding window, two pointers, dynamic programming, and more.
58 articles
A complete guide to two-pointer patterns for LeetCode: opposite-direction converging, same-direction fast/slow, and fixed-gap — when each applies, how to avoid infinite loops, and a problem roadmap from easy to hard.
A complete guide to Union Find (Disjoint Set Union) patterns for LeetCode: path compression, union by rank, when to choose UF over BFS/DFS, weighted Union Find, and a full template in Python and Java.
Master topological sort for LeetCode with Kahn's BFS and DFS post-order approaches. Learn cycle detection with in-degree tracking, apply both algorithms to Course Schedule, Alien Dictionary, and build-system dependency problems.
Master minimum spanning tree patterns for LeetCode with Kruskal's (sort + union-find) and Prim's (min-heap) algorithms. Learn when to use each, how Union-Find enables cycle detection, and recognize MST problems like connecting cities with minimum cost.
A complete guide to backtracking on LeetCode: learn the universal template, apply it to permutations, combinations, subsets, and constraint satisfaction problems, and know when to use backtracking versus dynamic programming.
Master graph traversal with BFS and DFS. Learn when to use each, how multi-source BFS works, the bidirectional BFS speedup, and how DFS state tracking detects cycles.
Master every prefix sum pattern for LeetCode: 1D range queries, 2D region sums, prefix XOR for range XOR queries, hashmap subarray counting for target sums, and difference arrays for batch range updates — all with templates and problem mappings.
A complete guide to heap and priority queue patterns on LeetCode: learn when to use heaps, the top-k, k-way merge, and two-heap median patterns, and the key differences between Python heapq and Java PriorityQueue.
A complete guide to LeetCode concurrency problems — mutex, semaphore, and thread-safe patterns tested at infrastructure-heavy companies like Uber, Netflix, and Apple.
Master the design patterns, SOLID principles, and class design questions that top companies test in OOP coding interviews.
Master the most common OOP design interview question. Learn how to design a parking lot with clean class hierarchies, SOLID principles, and extensible architecture.
Learn when to use a trie vs hash set in coding interviews. A clear decision framework for word search, autocomplete, and dictionary problems.
Master the segment tree pattern for range query LeetCode problems with a clean interview template, classic problems, and lazy propagation explained.
Master the 6 essential string problem patterns for coding interviews: two pointers, sliding window, hash maps, string building, palindromes, and pattern matching.
Learn the 3 dp space optimization techniques that reduce O(n) to O(1) and O(n^2) to O(n). Master rolling arrays, two-variable compression, and row reduction for coding interviews.
Master the Union-Find data structure for LeetCode with path compression, union by rank, and the classic problems where it outperforms BFS and DFS.
Master Dijkstra's algorithm for LeetCode — learn the priority queue template, when to use it vs BFS, and solve classic weighted graph interview problems.
Learn the 3 two pointer templates (opposite, same direction, fast/slow) that cover 30+ LeetCode problems. A universal guide with decision tables and practice strategy.
Master grid traversal, matrix manipulation, and DP on grids. Learn to recognize that every leetcode matrix problem is a graph problem in disguise.
A practical guide to choosing between memoization (top-down) and tabulation (bottom-up) for dynamic programming interview problems.
Master topological sort for coding interviews with Kahn's algorithm, DFS-based sorting, cycle detection, and the most common LeetCode dependency problems.
Dynamic programming trips up even experienced engineers. Learn the two-step framework — identify overlapping subproblems, write a recurrence relation — and you'll be able to tackle any DP problem on LeetCode.
Learn the binary search on answer space pattern — the template that turns Hard LeetCode problems into predictable solves with a simple feasibility check.
Trees and graphs appear in over a third of coding interviews. Learn the BFS and DFS patterns, templates, and classic problems you need to solve them confidently.
Learn the 6 graph algorithm patterns that cover nearly every coding interview graph problem — BFS, DFS, topological sort, union-find, and more with real LeetCode examples.
Master the sliding window technique with fixed and variable window templates that solve 15+ LeetCode problems. Includes the universal template and classic problem walkthroughs.
Two pointers and sliding window solve 20+ common LeetCode problems. Learn the mental models, see the classic problems, and drill the patterns with spaced repetition.
Master the quicksort partition pattern for LeetCode interviews. Learn Lomuto, Hoare, and Dutch National Flag partitioning with practice problems.
Master the 5 essential bit manipulation tricks that solve LeetCode problems in O(1) space — XOR, bitmasks, and the bitwise operators interviewers love to see.
Learn the critical difference between subarray and subsequence problems on LeetCode. Master sliding window, prefix sum, and DP patterns with a clear decision framework.
Most LeetCode grinders memorize solutions. The engineers who get hired recognize patterns. Here are the 15 core leetcode patterns that show up again and again in coding interviews.
A clear decision framework for choosing between BFS and DFS in coding interviews, with side-by-side comparisons and real LeetCode examples.
Master the 3 core interval patterns — merge, insert, and schedule — to confidently solve any interval problem on LeetCode and in coding interviews.
Learn the monotonic stack pattern to solve next greater element, daily temperatures, and histogram problems in O(n) time.
Go beyond Two Sum with 6 hash map patterns that cover frequency counting, grouping, prefix sums, and more — the complete hash map interview toolkit.
Learn the prefix sum pattern that turns O(n) range queries into O(1) lookups. Covers the template, hash map combo, and classic LeetCode problems like Subarray Sum Equals K.
Master the trie data structure pattern for LeetCode — from basic implementation to Word Search II, with templates and strategy.
Stacks and queues appear in more coding interviews than most people expect. This guide covers parentheses matching, monotonic stacks, queue patterns, and the key problems you need to know.
Master every binary tree pattern for coding interviews — DFS, BFS, BST tricks, and advanced path problems with reusable recursion templates.
Master heap and priority queue patterns for coding interviews. From top K elements to merging K sorted lists, these are the patterns that separate good candidates from great ones.
Binary search goes far beyond sorted arrays. Learn the template variations for rotated arrays, answer space problems, and the off-by-one traps that trip up even experienced engineers.
Arrays and hash maps are the most-tested category in coding interviews. Learn the core patterns — frequency counting, two-sum, grouping, and prefix sums — that turn brute-force into elegant O(n) solutions.
Master the 5 core linked list patterns — reversal, fast & slow pointers, merge, dummy heads, and edge case handling — to crack any linked list interview problem.
Master the backtracking algorithm template that solves permutations, combinations, subsets, N-Queens, and more. Learn when to use backtracking and how to prune for optimal performance.
LeetCode Design category guide: LRU Cache, Min Stack, LFU Cache, Design Twitter — master data structure composition for FAANG interviews.
All anagram problems — from Valid Anagram to Group Anagrams to Find All Anagrams — reduce to one insight: comparing character frequency maps. Master the four techniques that cover every variant on LeetCode.
Dijkstra's algorithm is the standard shortest-path solution for weighted graphs and appears across 10+ LeetCode problems under different names. Learn the 5-step min-heap pattern, recognize signal words like 'minimum cost' and 'network delay', and know when to use Bellman-Ford instead.
LLD interviews are distinct from system design — they test object-oriented modeling of a single system. Master the 5-step OOP framework and the three canonical problems: parking lot, elevator, and TinyURL.
Master the Bellman-Ford algorithm for LeetCode: negative edge weights, negative cycle detection, and the key problems — Cheapest Flights Within K Stops (#787), Network Delay Time (#743), and Find the City (#1334).
Learn how to approach simulation problems on LeetCode: board games like Design Tic-Tac-Toe (#348), grid cascades like Candy Crush (#723), and state machines like Snake Game (#353). The pattern that trips up even strong coders.
Master leetcode fibonacci by solving #509 four ways: naive recursion, memoization, tabulation, and space-optimized O(1). Then see how the same recurrence powers Climbing Stairs, House Robber, and Decode Ways.
LCA appears in Meta's top 10, Blind 75, and FAANG interview rotations. The recursive insight clicks fast — but the variants will trip you up without a clear mental model.
Greedy algorithms make the locally optimal choice at each step. The hard part is recognizing when that strategy is provably correct — and when it will blow up.
Stop memorizing every sort. In LeetCode interviews, sorting is a setup step that unlocks two pointers, greedy, and binary search — learn the 4 that actually matter.
Master bfs leetcode and dfs leetcode patterns. Learn the 5-question decision framework that tells you which traversal to use before writing a single line of code.
Master every leetcode palindrome pattern: two pointers, expand-around-center, DP for subsequences, and backtracking for partitioning.
Kadane's Algorithm solves Maximum Subarray in O(n) with one elegant DP insight. Learn why it works, how to implement it, and which LeetCode problems use it.
Learn when greedy algorithms work, when they fail, and how to prove your approach is correct. Covers Jump Game, Gas Station, interval scheduling, and the greedy vs DP decision framework.