Coding Interview Patterns

Course Overview
Intermediate
Free Course

For software engineers preparing for coding interviews who want to recognise which technique a problem needs instead of memorising solutions. Every pattern starts with the core idea, then works through the classic interview problems one by one — from the simple approach to the optimised technique, with tested Python code, dry runs and the follow-ups interviewers ask.

Instructor: MantraMindAI
Sections: 20

Course Content

Section 1: Foundations: Complexity and Pattern Recognition

Read time and space cost straight off code, use the input limits to rule approaches in or out, and turn a new problem into a short list of candidate patterns before you write a line.

Section 5: Fast and Slow Pointers
Section 7: Binary Search
Section 8: Stacks

Hold unfinished work in the order you will finish it — matching brackets, evaluating expressions, and answering "next greater" questions in one pass with a monotonic stack.

Section 9: Heaps

Use a heap whenever you need the smallest or largest item of a collection that keeps changing — top K, k-way merge, scheduling and the running median — and know when a sort or quickselect is the simpler answer.

Section 10: Intervals

Sort a list of start–end pairs by the correct endpoint, then merge, insert, remove overlaps and count rooms in one sweep — and settle whether touching intervals overlap before you write a single comparison.

Section 11: Prefix Sums

Precompute running totals once, so every question about a contiguous range becomes one subtraction — and, with a hash map, count or measure subarrays in a single pass.

Section 12: Trees
Section 13: Tries

Store words so that a prefix question costs the length of the prefix, not the size of the dictionary, and use that to build autocomplete, wildcard search and multi-word grid search — and know when a plain hash set is the better choice.

Section 14: Graphs

Model relations, grids and dependencies as graphs, and solve them with BFS, DFS, topological sort, Union-Find and Dijkstra — picking the right one from the shape of the problem.

Section 15: Backtracking

Generate every subset, ordering and valid arrangement with one choose–explore–undo template, skip duplicate answers, and prune dead branches before they cost you.

Section 16: Dynamic Programming

Turn a slow recursion into a fast table: define the state, write the transition, then go from brute force to memoisation, tabulation and a space-saving loop on the problems interviewers ask most.

Section 17: Greedy

Commit to the locally best choice and never look back — and learn to prove that choice is safe, or break it with a small counter-example, before you write a line of code.

Section 18: Sort and Search

Use sorting as a tool — to make a hard question local, to define a custom order, to select one element without sorting everything, or to count out-of-order pairs during a merge — and know exactly what each sort costs.

Section 19: Bit Manipulation

Read numbers as rows of bits, and use AND, OR, XOR and shifts to cancel pairs, count and reverse bits, add without `+`, and list every subset — with the Python-specific care that unbounded integers need.

Section 20: Math and Geometry

Solve the problems whose difficulty is an arithmetic or geometric fact — matrix index games, fast powers, primes, GCD and points on a line — while staying in exact integer arithmetic and avoiding overflow and floating-point traps.