Interview preparation

Algorithms

The NeetCode 250 problem set, organized the way NeetCode subdivides it: eighteen topics in roadmap order, where each one builds on the techniques of the ones before it. Every problem carries a refresher underneath covering what it asks, how the solution works, and the trick behind it, and links to its topic page, where solutions appear side by side in Python, C++, Rust, TypeScript, Go, and Swift with a language switcher. A solution is published only after its implementation passes unit tests against the official LeetCode examples.

01

Arrays & Hashing

The foundation everything else builds on. Most optimal solutions here replace a rescan with something remembered: a hash set, a frequency table, a prefix sum, or a canonical key that makes equal things look equal.

02

Two Pointers

When the input is sorted or mirrored, two indexes that only move toward each other can replace a full pass over every pair, cutting quadratic work to linear.

03

Sliding Window

A window over the array grows on the right and shrinks on the left while its state updates incrementally, so every substring question stops costing a fresh scan.

04

Stack

A stack remembers exactly the prefix that is still unresolved. The monotonic variants answer next-greater and span questions in one pass by popping everything the current element settles.

06

Linked List

Pointer rewiring under constraints: dummy heads remove edge cases, fast and slow pointers find middles and cycles, and the two cache designs are the classic structure-composition interviews.

07

Trees

Nearly every tree problem is one recursion shape: return a fact about each subtree once, combine the children's answers, and keep a separate best when the answer is not the return value.

08

Heap / Priority Queue

A heap keeps only what matters: the top k of a stream, the next event by time, or the boundary between the lower and upper half of the data.

09

Backtracking

One template generates the whole topic: choose, recurse, undo. The problems differ only in what a choice is, what prunes a branch, and when to record a result.

10

Tries

A prefix tree turns whole-word lookups into per-character walks, which is what makes searching a grid for hundreds of words at once tractable.

11

Graphs

BFS for distances, DFS for structure, indegrees for ordering, and union-find for connectivity. The twelve canonical traversal variants are written out in six languages on the graph traversal page.

12

Advanced Graphs

Weighted edges change the rules: Dijkstra and its max-edge variants, minimum spanning trees, Bellman-Ford under a stop budget, and Eulerian paths.

13

1-D Dynamic Programming

Name the subproblem in one sentence, write the transition, and fill states in dependency order. These are the linear-state problems where that habit gets built.

14

2-D Dynamic Programming

Two indexes of state: prefix pairs for string alignment, intervals for games and balloons, and grids where the path itself is the state.

15

Greedy

A greedy solution stands on an exchange argument: the locally best choice never blocks a globally best one. Each problem here teaches a distinct invariant worth saying out loud before coding.

16

Intervals

Sort by the boundary that controls conflicts, then sweep once. Sorting by end time solves scheduling; sorting by start time solves merging.

17

Math & Geometry

Simulation problems where the win is finding the exact numeric invariant: matrix layers, carries, modular identities, and exponentiation by squaring.

18

Bit Manipulation

A small toolbox that shows up everywhere: XOR cancellation, clearing the lowest set bit, and building answers bit by bit from the top.