HomeCoursesBlog
Blog

Insights & Guides

Deep dives into coding patterns, data structures, algorithms, and software engineering interview best practices.

The 10 Coding Interview Templates on One Page

The 10 Coding Interview Templates on One Page

Ten reusable code templates covering most coding interview questions, on one page. Each lists the words in the question that point to it, the code, the complexity, and the single bug that breaks it most often.

Grokking the Low Level Design Interview: OOD Principles End to End

Grokking the Low Level Design Interview: OOD Principles End to End

One parking lot design worked from requirements to classes, stopping wherever an OOD principle changes the code. What the round asks for, SOLID stated plainly, the first design and where it breaks, and the three patterns in almost every question.

Longest Common Subsequence: The DP Family Behind Edit Distance

Longest Common Subsequence: The DP Family Behind Edit Distance

Master the LCS dynamic programming family: the two-line recurrence over two sequences, why the table has an extra row and column, how Edit Distance is the same grid with three choices, the subsequence versus substring difference, and a practice ladder.

0/1 Knapsack: The First Dynamic Programming Family to Learn

0/1 Knapsack: The First Dynamic Programming Family to Learn

Master the 0/1 knapsack pattern: the include or exclude choice that generates the recurrence, the top-down derivation, the 1D loop whose direction enforces single use, why the complexity is pseudo-polynomial, and a practice ladder.

Matrix Traversal Pattern: Islands, Flood Fill, and Grid BFS

Matrix Traversal Pattern: Islands, Flood Fill, and Grid BFS

Master the matrix traversal pattern: why a grid is a graph, the neighbour helper both templates share, the one question that decides DFS or BFS, multi-source BFS, the visited-marking bug that breaks step counts, and a practice ladder.

Cyclic Sort Pattern: Solving Missing-Number Questions in O(n)

Cyclic Sort Pattern: Solving Missing-Number Questions in O(n)

Master the cyclic sort pattern: why each value knows its own index, the swap loop that must compare values rather than indices, the amortized O(n) argument, the alternatives it beats, and a practice ladder up to First Missing Positive.

Trie Pattern: Prefix Search Questions and the Standard Implementation

Trie Pattern: Prefix Search Questions and the Standard Implementation

Master the trie pattern: the standard implementation with the is_word flag, why lookup cost depends on word length rather than dictionary size, the hash set boundary, Word Search II, and a practice ladder.

Union-Find Pattern: The Template for Connected Components

Union-Find Pattern: The Template for Connected Components

Master the union-find pattern: the disjoint set template with path compression and union by rank, why a failed union is a cycle detector, the compass for choosing it over BFS or DFS, and a practice ladder from Number of Provinces to Accounts Merge.

Topological Sort Pattern: Ordering Tasks With Dependencies

Topological Sort Pattern: Ordering Tasks With Dependencies

Master the topological sort pattern: Kahn's algorithm with in-degrees, why a short result means a cycle, the edge direction rule that causes most bugs, the level-by-level variant, and a practice ladder from Course Schedule to Alien Dictionary.

Backtracking Pattern: One Template for Subsets, Permutations, and Combinations

Backtracking Pattern: One Template for Subsets, Permutations, and Combinations

Master the backtracking pattern: the choose, explore, un-choose template, the table that separates subsets from combinations from permutations, the duplicate-skip rule, and the copy bug that breaks most first attempts.

Prefix Sum Pattern: The Template for Range Sum Questions

Prefix Sum Pattern: The Template for Range Sum Questions

Master the prefix sum pattern: the one-line identity that makes any range sum O(1), the hash map variant that solves Subarray Sum Equals K in a single pass, the boundary with sliding window, and a practice ladder up to 2D range queries.

Binary Search on the Answer: The Pattern Most People Miss

Binary Search on the Answer: The Pattern Most People Miss

Binary search does not need a sorted array, it needs a monotonic yes/no question. Learn the answer-space template behind Koko Eating Bananas and Split Array Largest Sum, the loop form that never spins forever, and a practice ladder.

Showing 12 of 49
Grokking the Coding Interview
One-Stop Portal For Coding Interviews.
Follow us:
Copyright © 2025 Coding Interview All rights reserved.