Interview Prep

A pattern-organized interview library: every problem is grouped by the algorithmic family it teaches (arrays & hashing, two pointers, sliding window, trees, graphs, DP, ...) and tagged with a difficulty tier — warm-up, standard, hard, or legendary. Every entry is solved in Python with the brute-force-then-optimal walkthrough you would actually deliver in a real interview. The goal is fluency, not memorisation.

Why Python: it has become the lingua franca for whiteboard interviews. Dict and set literals are unbeatable for the patterns we need; collections.Counter, heapq, and the slice syntax let solutions compress to the algorithmic essentials without Java-style ceremony.

The ML Engineering section at the bottom is the parallel track: stable softmax, gradients, attention, normalization, PCA — the numerical building blocks every ML candidate should be able to write from a cold start.

Arrays & Hashing

Indexing and presence checks. Hashmaps and sets as the "have I seen this before?" primitive.

Two Pointers

Two indices sweeping a sorted (or sortable) array — opposite ends, fast/slow, or partition style.

Sliding Window

A moving window over an array or string, expanding and contracting to maintain an invariant.

Stack

LIFO bookkeeping. Matching, monotonic stacks, and "nearest greater/smaller" patterns.

Binary Search

Halving the search space on a sorted (or monotone-predicate) input. The most over-rated and under-mastered primitive.

Linked List

Pointer juggling with dummy heads, fast/slow runners, and in-place reversal.

Trees

Recursion on binary trees — pre/in/post order, BFS, recursion with bounds, tree DP.

Trie

Prefix-indexed dictionaries. The right structure when "all words starting with..." is the bottleneck.

Heap / Priority Queue

Top-k, k-way merges, streaming medians. Min/max-heap as the streaming-priority primitive.

Backtracking

Decision trees explored by depth-first search with explicit undo. Subsets, permutations, constraint satisfaction.

Graphs

BFS/DFS on grids and graphs, topological sort, shortest paths.

Dynamic Programming

Optimal substructure. From linear recurrences (Fibonacci-shaped) up to 2D table DPs on strings.

Intervals

Sort by start, sweep, merge. The intervals canon.

ML Engineering

Numerical building blocks every ML engineer should be able to write: softmax, gradients, attention, normalization, PCA, sampling.