teaching booklet — then jump to notebook Java
See the algorithm, then see a problem
Each topic page is built so you can learn the method, not memorize a template. Every algorithm has a simple Java version, an interview Java version, one tiny example, and one full step-by-step dry run. When the idea is solid, the tables at the bottom of each algorithm jump into this notebook’s question cards — chapter 05 for full Java, chapter 24 for the cheat, chapter 25 for the 30-second clue, Round 4 coding if that family showed up in a leftover hour.
how to read a card
Four blocks, same order, every algorithm
If a card still feels thin, it is unfinished — come back to the topic page, not to a random LeetCode editorial. Job 10454435 still has no public IE that names a live-round question. Unnamed stays unnamed.
1. Simple JavaFewer moving parts. Comments say why a line exists — especially when a node is marked visited, when a stack pops, when a window shrinks.
2. Interview JavaWhat you actually type in Live Code: empty input, disconnected graphs,
Integer.compare, overflow-safe mid. Same idea, fewer training wheels.3. Example 1 — simpleThree to five nodes, or a 4-character string. You should be able to finish the dry-run table without looking at the code.
4. Example 2 — every stepA second input that hits the awkward case (stale Dijkstra heap entry, DFS returning up a path, window that shrinks twice). No skipped rows.
Where the notebook fits
This booklet is the “what is BFS / DFS / Kahn” layer. The Interview Notebook is the “this family showed up in someone else’s loop” layer. Click a row under Notebook problems only after you can dry-run Example 2. Chapter 05 is the full compilable Java. Chapter 24 is the 60-second speak. Chapter 25 is the clue → pattern scan. Round 4 chapter 6 is leftover-hour coding.
open a topic
Fifteen chapters, hardest cluster first
| Chapter | You should leave able to | Then open |
|---|---|---|
| 01 Graphs | BFS vs DFS on the same drawing; mark-on-enqueue; 3-state directed cycle; Kahn leftover = cycle | Rotten oranges, Course Schedule, Distance K, Open the Lock |
| 02 Trees / Heaps / Tries | Inorder vs level order; path that bends; size-k min-heap | Distance K, merge k lists, top-k, leaf path |
| 03 Backtracking | Choose / explore / un-choose; copy the path | Subsets, partition / combination |
| 04 DP | Say the recurrence before coding; 0/1 vs unbounded | House Robber II, Unique Paths, grid reward |
| 05 Greedy | Name a counterexample or say why local max is global | Remove k digits, jump / stock family |
| 06 Binary Search | Search a range of answers, not only an array | Koko / ship packages, aggressive cows |
| 07 Sliding Window | Fixed vs variable; atMost(k) − atMost(k−1) | Anagrams, Nice Subarrays, window max |
| 08 Two Pointers | Opposite-direction on sorted; fast/slow on a list | Celebrity, rain water, switching lists |
| 09 Intervals | Sort by start; merge vs count overlap | Merge intervals, min platforms |
| 10 Prefix Sum | range = pref[r] − pref[l−1]; map of prefix frequencies | Subarray sum K, sum = 0 |
| 11 Linked Lists | Dummy head; reverse three pointers | Merge k, reverse-k, max-sum switch |
| 12 Stacks & Queues | Monotonic stack of indices; deque max | Next greater, daily temps, LRU, min stack |
| 13 Hashing | One pass “have I seen this” | Group anagrams, loyal logs, two-sum shape |
| 14 Arrays & Strings | Honest Big-O; StringBuilder in a loop | Encoded frequency, next permutation |
| 15 Bits & Matrices | XOR cancel; transpose then reverse | Rotate 90°, max 1s row, sudoku validate |