Divide and Conquer Interview Patterns
6 min read The Pattern Divide and conquer splits a problem into independent subproblems, solves each recursively, and combines the results. Three steps: […] Read article
6 min read The Pattern Divide and conquer splits a problem into independent subproblems, solves each recursively, and combines the results. Three steps: […] Read article
6 min read GCD and LCM Euclidean algorithm: gcd(a,b) = gcd(b, a%b), base case gcd(a,0) = a. Time O(log min(a,b)). LCM: lcm(a,b) = Read article
5 min read Core Idea Build a prefix array where prefix[i] = arr[0] + arr[1] + … + arr[i-1]. Then any range sum Read article
7 min read Design patterns appear in coding interviews in two ways: the interviewer asks you to implement a specific pattern, or you’re Read article
7 min read Stock trading dynamic programming problems are a classic interview cluster. Every variant – one transaction, unlimited, at most k, cooldown, Read article
9 min read What is Interval DP? Interval DP is a dynamic programming pattern where you optimize over all sub-intervals of a range. Read article
10 min read 2D DP Pattern Overview 2D dynamic programming problems use a 2D table where dp[i][j] represents the optimal value considering only Read article
10 min read Advanced Heap Interview Patterns Heaps appear in a surprising number of interview problems beyond the simple “find the Kth largest Read article
9 min read Advanced Binary Search Interview Patterns Binary search is not just “is target in sorted array.” The real interview value comes Read article
9 min read Graph Traversal Interview Patterns Graph problems appear in nearly every senior engineering interview. The key is recognizing which traversal fits Read article
9 min read Dynamic Programming on Strings Interview Patterns String DP problems share a common structure: a 2D table where one dimension indexes Read article
8 min read Core Pattern Tree DP follows a single structural pattern: post-order DFS. You recurse into children first, then compute the answer Read article
10 min read Linked list problems trip up candidates because pointer manipulation is easy to mess up under pressure. These patterns cover every Read article
10 min read Sorting problems appear constantly in interviews – not just “implement merge sort” but as tools to simplify harder problems. Master Read article
8 min read When Greedy Works: The Exchange Argument Greedy algorithms make the locally optimal choice at each step. They are provably correct Read article