Ordered Map (TreeMap / SortedList) Interview Patterns
6 min read When to Use an Ordered Map (Sorted Dict / TreeMap) An ordered map maintains keys in sorted order with O(log […] Read article
// algorithms
Coding patterns with templates and walkthroughs: two pointers, sliding window, DP, graphs — and the problems each one unlocks.
6 min read When to Use an Ordered Map (Sorted Dict / TreeMap) An ordered map maintains keys in sorted order with O(log […] Read article
6 min read Core Idea A stack (LIFO) is the right tool when the most recently seen element determines the action for the 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 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
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
10 min read Strings appear in roughly 25-30% of coding interviews. Unlike arrays or trees, string problems have a concentrated set of patterns Read article
What's missing, wrong, or worth adding? One line helps.
Sent — thank you. We read every one.