mirror of
https://github.com/prdlk/leetcode.git
synced 2026-09-16 23:16:26 +00:00
docs(docs): restructure documentation hierarchy and rename files
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
title: 'Contiguous Linear'
|
title: 'Arrays and Strings'
|
||||||
description: 'O(1) index access, order is information.'
|
description: 'O(1) index access, order is information.'
|
||||||
sidebar:
|
sidebar:
|
||||||
order: 1
|
icon: play
|
||||||
label: Introduction
|
label: Overview
|
||||||
---
|
---
|
||||||
|
|
||||||
:::warning[Under construction]
|
:::warning[Under construction]
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
title: 'Two Pointers'
|
title: 'Two Pointers'
|
||||||
description: 'Converging/parallel index walk that prunes the O(n^2) pair space using order.'
|
description: 'Converging/parallel index walk that prunes the O(n^2) pair space using order.'
|
||||||
sidebar:
|
sidebar:
|
||||||
order: 2
|
icon: sticky-note
|
||||||
---
|
---
|
||||||
|
|
||||||
:::warning[Under construction]
|
:::warning[Under construction]
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
title: 'Sliding Window'
|
title: 'Sliding Window'
|
||||||
description: 'Two pointers plus incremental state between them.'
|
description: 'Two pointers plus incremental state between them.'
|
||||||
sidebar:
|
sidebar:
|
||||||
order: 3
|
icon: sticky-note
|
||||||
---
|
---
|
||||||
|
|
||||||
:::warning[Under construction]
|
:::warning[Under construction]
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
title: 'Prefix Sum'
|
title: 'Prefix Sum'
|
||||||
description: 'Precomputed cumulative state for O(1) range queries.'
|
description: 'Precomputed cumulative state for O(1) range queries.'
|
||||||
sidebar:
|
sidebar:
|
||||||
order: 4
|
icon: sticky-note
|
||||||
---
|
---
|
||||||
|
|
||||||
:::warning[Under construction]
|
:::warning[Under construction]
|
||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
title: 'Heap'
|
title: 'Common Patterns'
|
||||||
description: 'Partial order: cheap access to the extremum without a full sort.'
|
description: 'Precomputed cumulative state for O(1) range queries.'
|
||||||
sidebar:
|
sidebar:
|
||||||
order: 3
|
icon: star
|
||||||
---
|
---
|
||||||
|
|
||||||
:::warning[Under construction]
|
:::warning[Under construction]
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
title: 'Coding'
|
title: 'Coding'
|
||||||
description: 'There are only 6 structural families. Every pattern is a traversal or maintenance strategy over one of them.'
|
description: 'There are only 6 structural families. Every pattern is a traversal or maintenance strategy over one of them.'
|
||||||
sidebar:
|
sidebar:
|
||||||
label: Overview
|
label: Introduction
|
||||||
order: 1
|
order: 1
|
||||||
|
icon: code
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
title: Agenda
|
|
||||||
description: Track your progress
|
|
||||||
sidebar:
|
|
||||||
icon: calendar
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## The Method (three layers, strictly separated)
|
|
||||||
|
|
||||||
1. **Concept layer — HelloInterview lessons (UNTIMED).** Read the pattern lesson, work its interactive walkthrough problems slowly, extract the recognition triggers ("sorted array + pair target → two pointers"). No clock. Understanding is the deliverable.
|
|
||||||
2. **Application layer — NeetCode 150 A-set (TIMED, always).** Same day, solve the NC150 problems for that topic under clock: 20 min/medium, 12 min/easy, out loud, no pauses. First-attempt performance is logged.
|
|
||||||
3. **Transfer layer — B-set spaced repetition (TIMED, unseen problems).** For each concept, hold out a B-set of problems you have NEVER solved: HelloInterview's own practice problems for that pattern first, then LC pattern-tagged mediums when exhausted. Fire B-set problems at **+2 days, +5 days, +10 days** after the concept's learning day. Solving an unseen problem proves the concept transferred; re-solving a remembered one proves nothing.
|
|
||||||
## 1. Self-Evaluation Rubric (score every timed problem, A or B)
|
|
||||||
|
|
||||||
Score 0–2 on each axis, 10-point total, logged in the PM review:
|
|
||||||
|
|
||||||
| Axis | 2 | 1 | 0 |
|
|
||||||
|---|---|---|---|
|
|
||||||
| **Recognition** | Named the pattern ≤2 min | Found it after false start | Needed hint/gave up |
|
|
||||||
| **Plan-first** | Stated brute force + optimization path BEFORE code | Partial plan, coded early | Coded blind |
|
|
||||||
| **Execution** | Clean pass within time box | Solved over time / with bug caught late | DNF |
|
|
||||||
| **Analysis** | Complexity stated correctly + edge cases traced aloud | One of the two | Neither |
|
|
||||||
| **Verbalization** | Continuous narration throughout | Went silent under pressure | Mostly silent |
|
|
||||||
|
|
||||||
**Mastery states per concept (driven by B-set scores only):**
|
|
||||||
- 🟢 **Green:** 3 consecutive B-set problems ≥8/10 → concept exits rotation (spot-check weekly)
|
|
||||||
- 🟡 **Yellow:** B-set scores 6–7 → stays in +5/+10 rotation
|
|
||||||
- 🔴 **Red:** B-set score ≤5 → redo the HI lesson next morning, restart the +2/+5/+10 clock
|
|
||||||
The interview is scored on exactly these five axes. Grading yourself on them daily is the meta-rep.
|
|
||||||
|
|
||||||
## The 10-Hour Day (6 days/week; Sundays OFF, non-negotiable)
|
|
||||||
|
|
||||||
| Block | Time | Content |
|
|
||||||
|---|---|---|
|
|
||||||
| B1 | 2.0h | **HI concept layer:** today's pattern lesson + all walkthrough problems, untimed |
|
|
||||||
| B2 | 2.5h | **A-set:** today's NC150 problems for the pattern, fully timed, out loud |
|
|
||||||
| B3 | 1.5h | **B-set spaced repetition:** every problem due today at +2/+5/+10, timed, scored |
|
|
||||||
| B4 | 1.5h | **SD / Track B:** HelloInterview SD breakdowns & solo reps, mocks, or practical builds (Stripe integration, bug-squash, take-homes) per weekly schedule |
|
|
||||||
| B5 | 1.0h | **Behavioral / pipeline:** story writing & rehearsal, applications, DMs, screens |
|
|
||||||
| B6 | 0.5h | **Miss log + rubric scoring:** tag every sub-8 by failed axis; queue tomorrow's B-set |
|
|
||||||
| — | 1.0h | Breaks (2× 30 min, enforced — walk Angelo, lift, no screens) |
|
|
||||||
|
|
||||||
**Sustainability rule:** 60 hrs/week for 8 weeks is a real load even for you. Sundays fully off, breaks enforced, sleep ≥7h. Week 6 (onsites) is the week that counts — arriving at it cooked forfeits the whole camp.
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
title: Evaluation
|
|
||||||
description: Track your progress
|
|
||||||
sidebar:
|
|
||||||
icon: check-circle
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## The Method (three layers, strictly separated)
|
|
||||||
|
|
||||||
1. **Concept layer — HelloInterview lessons (UNTIMED).** Read the pattern lesson, work its interactive walkthrough problems slowly, extract the recognition triggers ("sorted array + pair target → two pointers"). No clock. Understanding is the deliverable.
|
|
||||||
2. **Application layer — NeetCode 150 A-set (TIMED, always).** Same day, solve the NC150 problems for that topic under clock: 20 min/medium, 12 min/easy, out loud, no pauses. First-attempt performance is logged.
|
|
||||||
3. **Transfer layer — B-set spaced repetition (TIMED, unseen problems).** For each concept, hold out a B-set of problems you have NEVER solved: HelloInterview's own practice problems for that pattern first, then LC pattern-tagged mediums when exhausted. Fire B-set problems at **+2 days, +5 days, +10 days** after the concept's learning day. Solving an unseen problem proves the concept transferred; re-solving a remembered one proves nothing.
|
|
||||||
## 1. Self-Evaluation Rubric (score every timed problem, A or B)
|
|
||||||
|
|
||||||
Score 0–2 on each axis, 10-point total, logged in the PM review:
|
|
||||||
|
|
||||||
| Axis | 2 | 1 | 0 |
|
|
||||||
|---|---|---|---|
|
|
||||||
| **Recognition** | Named the pattern ≤2 min | Found it after false start | Needed hint/gave up |
|
|
||||||
| **Plan-first** | Stated brute force + optimization path BEFORE code | Partial plan, coded early | Coded blind |
|
|
||||||
| **Execution** | Clean pass within time box | Solved over time / with bug caught late | DNF |
|
|
||||||
| **Analysis** | Complexity stated correctly + edge cases traced aloud | One of the two | Neither |
|
|
||||||
| **Verbalization** | Continuous narration throughout | Went silent under pressure | Mostly silent |
|
|
||||||
|
|
||||||
**Mastery states per concept (driven by B-set scores only):**
|
|
||||||
- 🟢 **Green:** 3 consecutive B-set problems ≥8/10 → concept exits rotation (spot-check weekly)
|
|
||||||
- 🟡 **Yellow:** B-set scores 6–7 → stays in +5/+10 rotation
|
|
||||||
- 🔴 **Red:** B-set score ≤5 → redo the HI lesson next morning, restart the +2/+5/+10 clock
|
|
||||||
The interview is scored on exactly these five axes. Grading yourself on them daily is the meta-rep.
|
|
||||||
|
|
||||||
## The 10-Hour Day (6 days/week; Sundays OFF, non-negotiable)
|
|
||||||
|
|
||||||
| Block | Time | Content |
|
|
||||||
|---|---|---|
|
|
||||||
| B1 | 2.0h | **HI concept layer:** today's pattern lesson + all walkthrough problems, untimed |
|
|
||||||
| B2 | 2.5h | **A-set:** today's NC150 problems for the pattern, fully timed, out loud |
|
|
||||||
| B3 | 1.5h | **B-set spaced repetition:** every problem due today at +2/+5/+10, timed, scored |
|
|
||||||
| B4 | 1.5h | **SD / Track B:** HelloInterview SD breakdowns & solo reps, mocks, or practical builds (Stripe integration, bug-squash, take-homes) per weekly schedule |
|
|
||||||
| B5 | 1.0h | **Behavioral / pipeline:** story writing & rehearsal, applications, DMs, screens |
|
|
||||||
| B6 | 0.5h | **Miss log + rubric scoring:** tag every sub-8 by failed axis; queue tomorrow's B-set |
|
|
||||||
| — | 1.0h | Breaks (2× 30 min, enforced — walk Angelo, lift, no screens) |
|
|
||||||
|
|
||||||
**Sustainability rule:** 60 hrs/week for 8 weeks is a real load even for you. Sundays fully off, breaks enforced, sleep ≥7h. Week 6 (onsites) is the week that counts — arriving at it cooked forfeits the whole camp.
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
title: Progress
|
|
||||||
description: Track your progress
|
|
||||||
sidebar:
|
|
||||||
icon: loader
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## The Method (three layers, strictly separated)
|
|
||||||
|
|
||||||
1. **Concept layer — HelloInterview lessons (UNTIMED).** Read the pattern lesson, work its interactive walkthrough problems slowly, extract the recognition triggers ("sorted array + pair target → two pointers"). No clock. Understanding is the deliverable.
|
|
||||||
2. **Application layer — NeetCode 150 A-set (TIMED, always).** Same day, solve the NC150 problems for that topic under clock: 20 min/medium, 12 min/easy, out loud, no pauses. First-attempt performance is logged.
|
|
||||||
3. **Transfer layer — B-set spaced repetition (TIMED, unseen problems).** For each concept, hold out a B-set of problems you have NEVER solved: HelloInterview's own practice problems for that pattern first, then LC pattern-tagged mediums when exhausted. Fire B-set problems at **+2 days, +5 days, +10 days** after the concept's learning day. Solving an unseen problem proves the concept transferred; re-solving a remembered one proves nothing.
|
|
||||||
## 1. Self-Evaluation Rubric (score every timed problem, A or B)
|
|
||||||
|
|
||||||
Score 0–2 on each axis, 10-point total, logged in the PM review:
|
|
||||||
|
|
||||||
| Axis | 2 | 1 | 0 |
|
|
||||||
|---|---|---|---|
|
|
||||||
| **Recognition** | Named the pattern ≤2 min | Found it after false start | Needed hint/gave up |
|
|
||||||
| **Plan-first** | Stated brute force + optimization path BEFORE code | Partial plan, coded early | Coded blind |
|
|
||||||
| **Execution** | Clean pass within time box | Solved over time / with bug caught late | DNF |
|
|
||||||
| **Analysis** | Complexity stated correctly + edge cases traced aloud | One of the two | Neither |
|
|
||||||
| **Verbalization** | Continuous narration throughout | Went silent under pressure | Mostly silent |
|
|
||||||
|
|
||||||
**Mastery states per concept (driven by B-set scores only):**
|
|
||||||
- 🟢 **Green:** 3 consecutive B-set problems ≥8/10 → concept exits rotation (spot-check weekly)
|
|
||||||
- 🟡 **Yellow:** B-set scores 6–7 → stays in +5/+10 rotation
|
|
||||||
- 🔴 **Red:** B-set score ≤5 → redo the HI lesson next morning, restart the +2/+5/+10 clock
|
|
||||||
The interview is scored on exactly these five axes. Grading yourself on them daily is the meta-rep.
|
|
||||||
|
|
||||||
## The 10-Hour Day (6 days/week; Sundays OFF, non-negotiable)
|
|
||||||
|
|
||||||
| Block | Time | Content |
|
|
||||||
|---|---|---|
|
|
||||||
| B1 | 2.0h | **HI concept layer:** today's pattern lesson + all walkthrough problems, untimed |
|
|
||||||
| B2 | 2.5h | **A-set:** today's NC150 problems for the pattern, fully timed, out loud |
|
|
||||||
| B3 | 1.5h | **B-set spaced repetition:** every problem due today at +2/+5/+10, timed, scored |
|
|
||||||
| B4 | 1.5h | **SD / Track B:** HelloInterview SD breakdowns & solo reps, mocks, or practical builds (Stripe integration, bug-squash, take-homes) per weekly schedule |
|
|
||||||
| B5 | 1.0h | **Behavioral / pipeline:** story writing & rehearsal, applications, DMs, screens |
|
|
||||||
| B6 | 0.5h | **Miss log + rubric scoring:** tag every sub-8 by failed axis; queue tomorrow's B-set |
|
|
||||||
| — | 1.0h | Breaks (2× 30 min, enforced — walk Angelo, lift, no screens) |
|
|
||||||
|
|
||||||
**Sustainability rule:** 60 hrs/week for 8 weeks is a real load even for you. Sundays fully off, breaks enforced, sleep ≥7h. Week 6 (onsites) is the week that counts — arriving at it cooked forfeits the whole camp.
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Recognition'
|
|
||||||
description: 'There are only 6 structural families. Every pattern is a traversal or maintenance strategy over one of them.'
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Family 1 — Contiguous Linear (arrays, strings)
|
|
||||||
*Structure property: O(1) index access, order is information.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Two Pointers** (7) | Converging/parallel index walk that prunes the O(n²) pair space using order | Sorted input · pair/triplet with target · palindrome · in-place partition |
|
|
||||||
| **Sliding Window** (5) | Two pointers + incremental state between them (Two Pointers with a payload) | "Longest/shortest substring/subarray with property X" · contiguous constraint |
|
|
||||||
| **Prefix Sum** (2) | Precomputed cumulative state → O(1) range queries | "Sum of range" · "subarray sum equals K" · repeated interval aggregation |
|
|
||||||
| **Binary Search** (5) | Halving over ANY monotonic predicate — not just sorted arrays | Sorted/rotated input · "minimize the maximum" · answer space is monotonic (Koko) |
|
|
||||||
| **Matrices** (3) | 2D index arithmetic; often a graph in disguise | Grid traversal/rotation/spiral · if cells have neighbors → it's Family 5 |
|
|
||||||
|
|
||||||
**Systems anchor:** prefix sum is a materialized view; sliding window is stream processing with an eviction policy.
|
|
||||||
|
|
||||||
## Family 2 — Nodal Linear (linked lists)
|
|
||||||
*Structure property: O(1) splice, no random access. Everything is pointer surgery.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Linked List** (5) | Three moves cover it all: fast/slow runners, reversal, dummy-head splicing | Cycle detection · middle/Nth-from-end · reverse/reorder · merge |
|
|
||||||
|
|
||||||
**Systems anchor:** LRU Cache = hashmap + doubly-linked list — the one hybrid that appears constantly (it's a cache eviction index).
|
|
||||||
|
|
||||||
## Family 3 — Auxiliary Ordering Structures (stack, heap)
|
|
||||||
*Structure property: you don't traverse them — you maintain them while traversing something else.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Stack** (5) | LIFO memory of "unresolved" items; monotonic stack = discard dominated candidates | Matching/nesting (parens) · "next greater element" · "previous smaller" · expression eval |
|
|
||||||
| **Heap** (5) | Partial order — cheap access to extremum without full sort | "Kth largest/smallest" · "top K" · merge K streams · running median (two heaps) |
|
|
||||||
|
|
||||||
**Systems anchor:** monotonic stack ≈ log compaction (drop entries superseded by newer state); heap ≈ priority scheduling / Dijkstra's frontier / timer wheels.
|
|
||||||
|
|
||||||
## Family 4 — Hierarchical (trees, tries)
|
|
||||||
*Structure property: recursive shape — every node roots a subtree. Solutions are recurrences.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **DFS on trees** (part of 13) | Post/pre/in-order recursion; answer composed from subtree answers | "Max depth / diameter / LCA / validate" · anything defined recursively |
|
|
||||||
| **BFS on trees** (part of 8) | Level-order via queue | "Level by level" · "right side view" · minimum depth |
|
|
||||||
| **Trie** (2) | Character-indexed tree; shared prefixes = shared paths | Prefix search · autocomplete · word dictionaries · many-string matching |
|
|
||||||
| **BST specifically** | Sorted array in tree form — in-order traversal IS sorted order | "Kth smallest in BST" · range queries · validate |
|
|
||||||
|
|
||||||
**Systems anchor:** trie ≈ radix routing table / IPLD path resolution; BST invariant ≈ index B-tree.
|
|
||||||
|
|
||||||
## Family 5 — Relational (graphs)
|
|
||||||
*Structure property: arbitrary edges; must track visited. Trees are just acyclic connected graphs — same traversals, plus bookkeeping.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **DFS on graphs** (13) | Exhaustive reachability; recursion + visited set | Islands/regions/flood fill · connectivity · cycle detection (directed: 3-color) |
|
|
||||||
| **BFS on graphs** (8) | Frontier expansion → **shortest path in unweighted graphs, always** | "Minimum steps/moves" · multi-source spread (rotting oranges) · word ladder |
|
|
||||||
| **Graphs** (6): Topological sort | DFS post-order reversed / Kahn's in-degree queue over a DAG | Dependencies · prerequisites · build order · "valid ordering exists?" |
|
|
||||||
| **Graphs** (6): Union-Find | Incremental connectivity without traversal | Dynamic "same component?" queries · redundant edge · counting components |
|
|
||||||
|
|
||||||
**Systems anchor:** topo sort = dependency resolution (your Turborepo build graph); union-find = partition detection; BFS = gossip propagation. A matrix with neighbor-moves is ALWAYS this family, not Family 1.
|
|
||||||
|
|
||||||
## Family 6 — Decision-Space (implicit graphs you build while exploring)
|
|
||||||
*Structure property: nodes are STATES, not data. The structure doesn't exist until you walk it.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Backtracking** (6) | DFS over the state tree with undo; exhaustive enumeration | "All subsets/permutations/combinations" · constraint satisfaction · "generate all valid X" |
|
|
||||||
| **Dynamic Programming** (10) | Backtracking + memoization — overlapping subproblems collapse the exponential tree | "Count ways" · "min/max cost to reach" · choices with shared substructure · optimal substructure |
|
|
||||||
| **Greedy** (5) | DP where the local optimum provably suffices — no memo needed | Sort-then-commit works · exchange argument holds · intervals scheduling · jump game |
|
|
||||||
|
|
||||||
**Systems anchor:** DP memo = idempotency cache over a deterministic state machine; backtracking = saga with compensating undo; greedy = eventually-consistent local decisions that provably converge.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## The Recognition Decision Tree (run this in the first 2 minutes — rubric axis #1)
|
|
||||||
|
|
||||||
1. **Contiguous array/string, no neighbor semantics?** → Family 1. Sorted or monotonic answer space → Binary Search. Pair/window constraint → Two/Sliding. Range sums → Prefix.
|
|
||||||
2. **Nodes with next-pointers?** → Family 2. Reach for fast/slow or dummy-head before anything clever.
|
|
||||||
3. **Need "next greater," nesting, or top-K while scanning?** → Family 3 auxiliary structure on top of whatever you're traversing.
|
|
||||||
4. **Recursive shape (tree/prefix data)?** → Family 4. Ask: does the answer compose from subtrees (DFS) or from levels (BFS)?
|
|
||||||
5. **Arbitrary connections, grids with movement, dependencies?** → Family 5. Unweighted shortest = BFS. Ordering over DAG = topo. Dynamic connectivity = union-find. Otherwise DFS.
|
|
||||||
6. **Enumerate or optimize over CHOICES?** → Family 6. All solutions → backtracking. Overlapping subproblems → DP. Provable local choice → greedy.
|
|
||||||
|
|
||||||
## The Escalation Lattice (when stuck, patterns upgrade along these edges)
|
|
||||||
|
|
||||||
- Two Pointers —*add state*→ Sliding Window —*add aggregation*→ Prefix Sum
|
|
||||||
- Brute-force scan —*monotonic predicate*→ Binary Search on answer
|
|
||||||
- Tree DFS —*add visited set*→ Graph DFS —*add undo*→ Backtracking —*add memo*→ DP —*add proof*→ Greedy
|
|
||||||
- Sort —*need only extremum*→ Heap —*need running extremes*→ Monotonic Stack
|
|
||||||
- BFS —*add weights*→ Dijkstra (= BFS with a heap: Families 3+5 composed)
|
|
||||||
|
|
||||||
Memorize the lattice, not 16 patterns. In the interview, naming the family out loud ("this is a state-space problem, so backtracking or DP depending on overlap") IS the recognition signal the rubric scores.
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Escalation'
|
|
||||||
description: 'There are only 6 structural families. Every pattern is a traversal or maintenance strategy over one of them.'
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Family 1 — Contiguous Linear (arrays, strings)
|
|
||||||
*Structure property: O(1) index access, order is information.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Two Pointers** (7) | Converging/parallel index walk that prunes the O(n²) pair space using order | Sorted input · pair/triplet with target · palindrome · in-place partition |
|
|
||||||
| **Sliding Window** (5) | Two pointers + incremental state between them (Two Pointers with a payload) | "Longest/shortest substring/subarray with property X" · contiguous constraint |
|
|
||||||
| **Prefix Sum** (2) | Precomputed cumulative state → O(1) range queries | "Sum of range" · "subarray sum equals K" · repeated interval aggregation |
|
|
||||||
| **Binary Search** (5) | Halving over ANY monotonic predicate — not just sorted arrays | Sorted/rotated input · "minimize the maximum" · answer space is monotonic (Koko) |
|
|
||||||
| **Matrices** (3) | 2D index arithmetic; often a graph in disguise | Grid traversal/rotation/spiral · if cells have neighbors → it's Family 5 |
|
|
||||||
|
|
||||||
**Systems anchor:** prefix sum is a materialized view; sliding window is stream processing with an eviction policy.
|
|
||||||
|
|
||||||
## Family 2 — Nodal Linear (linked lists)
|
|
||||||
*Structure property: O(1) splice, no random access. Everything is pointer surgery.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Linked List** (5) | Three moves cover it all: fast/slow runners, reversal, dummy-head splicing | Cycle detection · middle/Nth-from-end · reverse/reorder · merge |
|
|
||||||
|
|
||||||
**Systems anchor:** LRU Cache = hashmap + doubly-linked list — the one hybrid that appears constantly (it's a cache eviction index).
|
|
||||||
|
|
||||||
## Family 3 — Auxiliary Ordering Structures (stack, heap)
|
|
||||||
*Structure property: you don't traverse them — you maintain them while traversing something else.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Stack** (5) | LIFO memory of "unresolved" items; monotonic stack = discard dominated candidates | Matching/nesting (parens) · "next greater element" · "previous smaller" · expression eval |
|
|
||||||
| **Heap** (5) | Partial order — cheap access to extremum without full sort | "Kth largest/smallest" · "top K" · merge K streams · running median (two heaps) |
|
|
||||||
|
|
||||||
**Systems anchor:** monotonic stack ≈ log compaction (drop entries superseded by newer state); heap ≈ priority scheduling / Dijkstra's frontier / timer wheels.
|
|
||||||
|
|
||||||
## Family 4 — Hierarchical (trees, tries)
|
|
||||||
*Structure property: recursive shape — every node roots a subtree. Solutions are recurrences.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **DFS on trees** (part of 13) | Post/pre/in-order recursion; answer composed from subtree answers | "Max depth / diameter / LCA / validate" · anything defined recursively |
|
|
||||||
| **BFS on trees** (part of 8) | Level-order via queue | "Level by level" · "right side view" · minimum depth |
|
|
||||||
| **Trie** (2) | Character-indexed tree; shared prefixes = shared paths | Prefix search · autocomplete · word dictionaries · many-string matching |
|
|
||||||
| **BST specifically** | Sorted array in tree form — in-order traversal IS sorted order | "Kth smallest in BST" · range queries · validate |
|
|
||||||
|
|
||||||
**Systems anchor:** trie ≈ radix routing table / IPLD path resolution; BST invariant ≈ index B-tree.
|
|
||||||
|
|
||||||
## Family 5 — Relational (graphs)
|
|
||||||
*Structure property: arbitrary edges; must track visited. Trees are just acyclic connected graphs — same traversals, plus bookkeeping.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **DFS on graphs** (13) | Exhaustive reachability; recursion + visited set | Islands/regions/flood fill · connectivity · cycle detection (directed: 3-color) |
|
|
||||||
| **BFS on graphs** (8) | Frontier expansion → **shortest path in unweighted graphs, always** | "Minimum steps/moves" · multi-source spread (rotting oranges) · word ladder |
|
|
||||||
| **Graphs** (6): Topological sort | DFS post-order reversed / Kahn's in-degree queue over a DAG | Dependencies · prerequisites · build order · "valid ordering exists?" |
|
|
||||||
| **Graphs** (6): Union-Find | Incremental connectivity without traversal | Dynamic "same component?" queries · redundant edge · counting components |
|
|
||||||
|
|
||||||
**Systems anchor:** topo sort = dependency resolution (your Turborepo build graph); union-find = partition detection; BFS = gossip propagation. A matrix with neighbor-moves is ALWAYS this family, not Family 1.
|
|
||||||
|
|
||||||
## Family 6 — Decision-Space (implicit graphs you build while exploring)
|
|
||||||
*Structure property: nodes are STATES, not data. The structure doesn't exist until you walk it.*
|
|
||||||
|
|
||||||
| Pattern | What it really is | Recognition triggers |
|
|
||||||
|---|---|---|
|
|
||||||
| **Backtracking** (6) | DFS over the state tree with undo; exhaustive enumeration | "All subsets/permutations/combinations" · constraint satisfaction · "generate all valid X" |
|
|
||||||
| **Dynamic Programming** (10) | Backtracking + memoization — overlapping subproblems collapse the exponential tree | "Count ways" · "min/max cost to reach" · choices with shared substructure · optimal substructure |
|
|
||||||
| **Greedy** (5) | DP where the local optimum provably suffices — no memo needed | Sort-then-commit works · exchange argument holds · intervals scheduling · jump game |
|
|
||||||
|
|
||||||
**Systems anchor:** DP memo = idempotency cache over a deterministic state machine; backtracking = saga with compensating undo; greedy = eventually-consistent local decisions that provably converge.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## The Recognition Decision Tree (run this in the first 2 minutes — rubric axis #1)
|
|
||||||
|
|
||||||
1. **Contiguous array/string, no neighbor semantics?** → Family 1. Sorted or monotonic answer space → Binary Search. Pair/window constraint → Two/Sliding. Range sums → Prefix.
|
|
||||||
2. **Nodes with next-pointers?** → Family 2. Reach for fast/slow or dummy-head before anything clever.
|
|
||||||
3. **Need "next greater," nesting, or top-K while scanning?** → Family 3 auxiliary structure on top of whatever you're traversing.
|
|
||||||
4. **Recursive shape (tree/prefix data)?** → Family 4. Ask: does the answer compose from subtrees (DFS) or from levels (BFS)?
|
|
||||||
5. **Arbitrary connections, grids with movement, dependencies?** → Family 5. Unweighted shortest = BFS. Ordering over DAG = topo. Dynamic connectivity = union-find. Otherwise DFS.
|
|
||||||
6. **Enumerate or optimize over CHOICES?** → Family 6. All solutions → backtracking. Overlapping subproblems → DP. Provable local choice → greedy.
|
|
||||||
|
|
||||||
## The Escalation Lattice (when stuck, patterns upgrade along these edges)
|
|
||||||
|
|
||||||
- Two Pointers —*add state*→ Sliding Window —*add aggregation*→ Prefix Sum
|
|
||||||
- Brute-force scan —*monotonic predicate*→ Binary Search on answer
|
|
||||||
- Tree DFS —*add visited set*→ Graph DFS —*add undo*→ Backtracking —*add memo*→ DP —*add proof*→ Greedy
|
|
||||||
- Sort —*need only extremum*→ Heap —*need running extremes*→ Monotonic Stack
|
|
||||||
- BFS —*add weights*→ Dijkstra (= BFS with a heap: Families 3+5 composed)
|
|
||||||
|
|
||||||
Memorize the lattice, not 16 patterns. In the interview, naming the family out loud ("this is a state-space problem, so backtracking or DP depending on overlap") IS the recognition signal the rubric scores.
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Binary Search'
|
|
||||||
description: 'Halving over any monotonic predicate, not just sorted arrays.'
|
|
||||||
sidebar:
|
|
||||||
order: 5
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Matrices'
|
|
||||||
description: '2D index arithmetic; often a graph in disguise.'
|
|
||||||
sidebar:
|
|
||||||
order: 6
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Nodal Linear'
|
|
||||||
description: 'O(1) splice, no random access. Everything is pointer surgery.'
|
|
||||||
sidebar:
|
|
||||||
order: 1
|
|
||||||
label: Introduction
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Patterns
|
|
||||||
|
|
||||||
- [Linked List](/guides/coding/nodal-linear/linked-list) — Fast/slow runners, reversal, and dummy-head splicing cover it all.
|
|
||||||
|
|
||||||
**Systems anchor:** LRU cache = hashmap + doubly-linked list, the one hybrid that appears constantly.
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Linked List'
|
|
||||||
description: 'Fast/slow runners, reversal, and dummy-head splicing cover it all.'
|
|
||||||
sidebar:
|
|
||||||
order: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
order: 5,
|
|
||||||
});
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Auxiliary Ordering Structures'
|
|
||||||
description: 'You do not traverse them; you maintain them while traversing something else.'
|
|
||||||
sidebar:
|
|
||||||
order: 1
|
|
||||||
label: Introduction
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Patterns
|
|
||||||
|
|
||||||
- [Stack](/guides/coding/auxiliary-ordering/stack) — LIFO memory of unresolved items; monotonic stack discards dominated candidates.
|
|
||||||
- [Heap](/guides/coding/auxiliary-ordering/heap) — Partial order: cheap access to the extremum without a full sort.
|
|
||||||
|
|
||||||
**Systems anchor:** Monotonic stack is log compaction; heap is priority scheduling, Dijkstra's frontier, timer wheels.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
order: 6,
|
|
||||||
});
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Stack'
|
|
||||||
description: 'LIFO memory of unresolved items; monotonic stack discards dominated candidates.'
|
|
||||||
sidebar:
|
|
||||||
order: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Binary Search Tree'
|
|
||||||
description: 'A sorted array in tree form: in-order traversal is sorted order.'
|
|
||||||
sidebar:
|
|
||||||
order: 5
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Hierarchical'
|
|
||||||
description: 'Recursive shape: every node roots a subtree. Solutions are recurrences.'
|
|
||||||
sidebar:
|
|
||||||
order: 1
|
|
||||||
label: Introduction
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Patterns
|
|
||||||
|
|
||||||
- [DFS on Trees](/guides/coding/hierarchical/tree-dfs) — Post/pre/in-order recursion; the answer composes from subtree answers.
|
|
||||||
- [BFS on Trees](/guides/coding/hierarchical/tree-bfs) — Level-order traversal via a queue.
|
|
||||||
- [Trie](/guides/coding/hierarchical/trie) — Character-indexed tree; shared prefixes are shared paths.
|
|
||||||
- [Binary Search Tree](/guides/coding/hierarchical/binary-search-tree) — A sorted array in tree form: in-order traversal is sorted order.
|
|
||||||
|
|
||||||
**Systems anchor:** Trie is a radix routing table / IPLD path resolution; the BST invariant is a B-tree index.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
order: 7,
|
|
||||||
});
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'BFS on Trees'
|
|
||||||
description: 'Level-order traversal via a queue.'
|
|
||||||
sidebar:
|
|
||||||
order: 3
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'DFS on Trees'
|
|
||||||
description: 'Post/pre/in-order recursion; the answer composes from subtree answers.'
|
|
||||||
sidebar:
|
|
||||||
order: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Trie'
|
|
||||||
description: 'Character-indexed tree; shared prefixes are shared paths.'
|
|
||||||
sidebar:
|
|
||||||
order: 4
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'BFS on Graphs'
|
|
||||||
description: 'Frontier expansion: shortest path in unweighted graphs, always.'
|
|
||||||
sidebar:
|
|
||||||
order: 3
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'DFS on Graphs'
|
|
||||||
description: 'Exhaustive reachability: recursion plus a visited set.'
|
|
||||||
sidebar:
|
|
||||||
order: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Relational'
|
|
||||||
description: 'Arbitrary edges; you must track visited. Trees are acyclic connected graphs with less bookkeeping.'
|
|
||||||
sidebar:
|
|
||||||
order: 1
|
|
||||||
label: Introduction
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Patterns
|
|
||||||
|
|
||||||
- [DFS on Graphs](/guides/coding/relational/graph-dfs) — Exhaustive reachability: recursion plus a visited set.
|
|
||||||
- [BFS on Graphs](/guides/coding/relational/graph-bfs) — Frontier expansion: shortest path in unweighted graphs, always.
|
|
||||||
- [Topological Sort](/guides/coding/relational/topological-sort) — Reversed DFS post-order, or Kahn's in-degree queue over a DAG.
|
|
||||||
- [Union-Find](/guides/coding/relational/union-find) — Incremental connectivity without traversal.
|
|
||||||
|
|
||||||
**Systems anchor:** Topological sort is dependency resolution; union-find is partition detection; BFS is gossip propagation.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
order: 8,
|
|
||||||
});
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Topological Sort'
|
|
||||||
description: "Reversed DFS post-order, or Kahn's in-degree queue over a DAG."
|
|
||||||
sidebar:
|
|
||||||
order: 4
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Union-Find'
|
|
||||||
description: 'Incremental connectivity without traversal.'
|
|
||||||
sidebar:
|
|
||||||
order: 5
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Backtracking'
|
|
||||||
description: 'DFS over the state tree with undo; exhaustive enumeration.'
|
|
||||||
sidebar:
|
|
||||||
order: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Dynamic Programming'
|
|
||||||
description: 'Backtracking plus memoization over overlapping subproblems.'
|
|
||||||
sidebar:
|
|
||||||
order: 3
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Greedy'
|
|
||||||
description: 'DP where the local optimum provably suffices, so no memo is needed.'
|
|
||||||
sidebar:
|
|
||||||
order: 4
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Decision-Space'
|
|
||||||
description: 'Nodes are states, not data. The structure does not exist until you walk it.'
|
|
||||||
sidebar:
|
|
||||||
order: 1
|
|
||||||
label: Introduction
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Patterns
|
|
||||||
|
|
||||||
- [Backtracking](/guides/coding/decision-space/backtracking) — DFS over the state tree with undo; exhaustive enumeration.
|
|
||||||
- [Dynamic Programming](/guides/coding/decision-space/dynamic-programming) — Backtracking plus memoization over overlapping subproblems.
|
|
||||||
- [Greedy](/guides/coding/decision-space/greedy) — DP where the local optimum provably suffices, so no memo is needed.
|
|
||||||
|
|
||||||
**Systems anchor:** DP memo is an idempotency cache; backtracking is a saga with compensating undo; greedy is local decisions that converge.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
order: 9,
|
|
||||||
});
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'B-Tree Indexes'
|
|
||||||
description: 'The BST ordering invariant as a database index.'
|
|
||||||
sidebar:
|
|
||||||
order: 8
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Hierarchical.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Cache Eviction'
|
|
||||||
description: 'LRU cache as a hashmap plus a doubly-linked eviction index.'
|
|
||||||
sidebar:
|
|
||||||
order: 4
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Nodal Linear.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Dependency Resolution'
|
|
||||||
description: 'Topological sort as build-graph and package resolution.'
|
|
||||||
sidebar:
|
|
||||||
order: 9
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Relational.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Eventual Consistency'
|
|
||||||
description: 'Greedy local decisions that provably converge.'
|
|
||||||
sidebar:
|
|
||||||
order: 14
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Decision-Space.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Gossip Propagation'
|
|
||||||
description: 'BFS frontier expansion as epidemic broadcast.'
|
|
||||||
sidebar:
|
|
||||||
order: 11
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Relational.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Idempotency Caches'
|
|
||||||
description: 'A DP memo as an idempotency cache over a deterministic state machine.'
|
|
||||||
sidebar:
|
|
||||||
order: 12
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Decision-Space.
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'System Design'
|
|
||||||
description: 'The systems anchor behind each coding family: the same structure, at production scale.'
|
|
||||||
sidebar:
|
|
||||||
order: 1
|
|
||||||
label: Overview
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Systems anchors
|
|
||||||
|
|
||||||
- [Materialized Views](/guides/system-design/materialized-views) — Prefix sum as a precomputed, read-optimized projection. *(Contiguous Linear)*
|
|
||||||
- [Stream Processing](/guides/system-design/stream-processing) — Sliding window as a bounded stream with an eviction policy. *(Contiguous Linear)*
|
|
||||||
- [Cache Eviction](/guides/system-design/cache-eviction) — LRU cache as a hashmap plus a doubly-linked eviction index. *(Nodal Linear)*
|
|
||||||
- [Log Compaction](/guides/system-design/log-compaction) — Monotonic stack as dropping entries superseded by newer state. *(Auxiliary Ordering)*
|
|
||||||
- [Priority Scheduling](/guides/system-design/priority-scheduling) — Heaps behind schedulers, Dijkstra's frontier, and timer wheels. *(Auxiliary Ordering)*
|
|
||||||
- [Radix Routing Tables](/guides/system-design/radix-routing-tables) — Tries behind routing tables and IPLD path resolution. *(Hierarchical)*
|
|
||||||
- [B-Tree Indexes](/guides/system-design/btree-indexes) — The BST ordering invariant as a database index. *(Hierarchical)*
|
|
||||||
- [Dependency Resolution](/guides/system-design/dependency-resolution) — Topological sort as build-graph and package resolution. *(Relational)*
|
|
||||||
- [Partition Detection](/guides/system-design/partition-detection) — Union-find as dynamic connectivity across a cluster. *(Relational)*
|
|
||||||
- [Gossip Propagation](/guides/system-design/gossip-propagation) — BFS frontier expansion as epidemic broadcast. *(Relational)*
|
|
||||||
- [Idempotency Caches](/guides/system-design/idempotency-caches) — A DP memo as an idempotency cache over a deterministic state machine. *(Decision-Space)*
|
|
||||||
- [Sagas and Compensation](/guides/system-design/sagas-and-compensation) — Backtracking as a saga with compensating undo. *(Decision-Space)*
|
|
||||||
- [Eventual Consistency](/guides/system-design/eventual-consistency) — Greedy local decisions that provably converge. *(Decision-Space)*
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Log Compaction'
|
|
||||||
description: 'Monotonic stack as dropping entries superseded by newer state.'
|
|
||||||
sidebar:
|
|
||||||
order: 5
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Auxiliary Ordering.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Materialized Views'
|
|
||||||
description: 'Prefix sum as a precomputed, read-optimized projection.'
|
|
||||||
sidebar:
|
|
||||||
order: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Contiguous Linear.
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
title: "System Design",
|
|
||||||
order: 2,
|
|
||||||
collapsed: true,
|
|
||||||
icon: "monitor-cog",
|
|
||||||
display: "page",
|
|
||||||
});
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Partition Detection'
|
|
||||||
description: 'Union-find as dynamic connectivity across a cluster.'
|
|
||||||
sidebar:
|
|
||||||
order: 10
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Relational.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Priority Scheduling'
|
|
||||||
description: "Heaps behind schedulers, Dijkstra's frontier, and timer wheels."
|
|
||||||
sidebar:
|
|
||||||
order: 6
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Auxiliary Ordering.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Radix Routing Tables'
|
|
||||||
description: 'Tries behind routing tables and IPLD path resolution.'
|
|
||||||
sidebar:
|
|
||||||
order: 7
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Hierarchical.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Sagas and Compensation'
|
|
||||||
description: 'Backtracking as a saga with compensating undo.'
|
|
||||||
sidebar:
|
|
||||||
order: 13
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Decision-Space.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Stream Processing'
|
|
||||||
description: 'Sliding window as a bounded stream with an eviction policy.'
|
|
||||||
sidebar:
|
|
||||||
order: 3
|
|
||||||
---
|
|
||||||
|
|
||||||
:::warning[Under construction]
|
|
||||||
This page is a scaffold. Notes, canonical problems, and template code are not written yet.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Coding family:** Contiguous Linear.
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Coding'
|
|
||||||
sidebar:
|
|
||||||
label: Overview
|
|
||||||
icon: arrow-right-circle
|
|
||||||
order: 1
|
|
||||||
---
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
Given two integer arrays `nums1` and `nums2`, return the minimum number of operations required to make both arrays equal.
|
|
||||||
|
|
||||||
You have the following three choices to modify two arrays:
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { defineMeta } from "blume";
|
|
||||||
|
|
||||||
export default defineMeta({
|
|
||||||
title: "Behavioral",
|
|
||||||
order: 3,
|
|
||||||
collapsed: true,
|
|
||||||
icon: "handshake",
|
|
||||||
display: "page",
|
|
||||||
});
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
---
|
|
||||||
title: About
|
|
||||||
description: Common questions about Blume — how it compares to other documentation tools, and why a Markdown formatter might collapse your callout directives.
|
|
||||||
sidebar:
|
|
||||||
icon: heart
|
|
||||||
---
|
|
||||||
|
|
||||||
Answers to questions that come up often. Missing one? [Open an issue](https://github.com/haydenbleasel/blume/issues) or ask the in-page assistant.
|
|
||||||
|
|
||||||
## How is Blume different from Mintlify, Fumadocs, and others?
|
|
||||||
|
|
||||||
Most documentation tools sit at one of two extremes. **Managed platforms** like Mintlify give you a polished result fast, but the build and hosting are their service — you author inside their system and deploy to their infrastructure. **Component libraries and starters** like Fumadocs, Nextra, or Docusaurus are open-source and flexible, but they hand you an application (a Next.js or React project) that you scaffold, wire up, and maintain before and after you write a word.
|
|
||||||
|
|
||||||
Blume takes a third path: **the framework is the template.** You point it at a folder of Markdown and it generates and drives the whole site — navigation, search, theming, Open Graph images, SEO, and AI endpoints — with no app to own. It's fully open-source and self-hostable, so there's no managed service and no vendor lock-in, but there's also no boilerplate to maintain.
|
|
||||||
|
|
||||||
| | Blume | Mintlify | Fumadocs / Nextra / Docusaurus |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| **Model** | Zero-config framework; content only | Hosted platform | Library + app you scaffold |
|
|
||||||
| **Source** | Open-source (MIT) | Closed core | Open-source |
|
|
||||||
| **Hosting** | Anywhere — static or a server function | Their managed infrastructure | Anywhere; you build and deploy |
|
|
||||||
| **You maintain** | Your Markdown | Your Markdown + platform config | Your Markdown + the app around it |
|
|
||||||
| **Rendering** | Astro; core theme ships zero client JS | Their runtime | React/Next.js runtime |
|
|
||||||
| **AI features** | `llms.txt`, raw Markdown, Ask AI, MCP — built in, no hosted service | Built in (hosted) | Bring your own |
|
|
||||||
|
|
||||||
A few consequences worth calling out:
|
|
||||||
|
|
||||||
- **You own the output.** `blume build` produces a plain site you host on Vercel, Netlify, Cloudflare, S3, or your own box. Nothing phones home.
|
|
||||||
- **No lock-in, two ways out.** Your content is portable Markdown, and `blume eject` turns the project into a standalone Astro app that still uses the `blume` package when you want full control.
|
|
||||||
- **Fast by default.** The core theme is React-free and renders static HTML, so pages score well on Core Web Vitals without tuning. You opt into server features (Ask AI, MCP) only when you need them.
|
|
||||||
- **Type-safe configuration.** `blume.config.ts` and every `meta.ts` are real TypeScript validated by a schema — not loosely-typed YAML.
|
|
||||||
|
|
||||||
:::note
|
|
||||||
This isn't "better than everything" — managed platforms and full frameworks are the right call when you want a hosted product or maximum control over the app. Blume is for teams who want a production-grade docs site without owning either the platform or the plumbing.
|
|
||||||
:::
|
|
||||||
|
|
||||||
See [Why Blume exists](/docs) for the longer version.
|
|
||||||
|
|
||||||
## Is Blume free and open-source?
|
|
||||||
|
|
||||||
Yes — Blume is MIT-licensed and free. You install the `blume` package, keep your content in your own repository, and host the build wherever you like. There's no paid tier, no per-seat pricing, and no account to sign up for. The source lives on [GitHub](https://github.com/haydenbleasel/blume).
|
|
||||||
|
|
||||||
## Do I need to know Astro, React, or Tailwind?
|
|
||||||
|
|
||||||
No. A folder of Markdown is a complete site — navigation, search, and theming are inferred or set with a handful of tokens. You only reach for the underlying stack when you want to customize: [interactive islands](/docs/content/islands) (React), [component overrides](/docs/configuration/customization), or [theme tokens](/docs/configuration/theming) (Tailwind). Even then, [`blume.config.ts`](/docs/configuration) is typed, so your editor guides you.
|
|
||||||
|
|
||||||
## Can I use React components and MDX?
|
|
||||||
|
|
||||||
Yes. Any page can be `.md` or `.mdx`, and MDX lets you drop in the [built-in components](/docs/content/components) with no imports. You can also add your own `.tsx`/`.jsx` [islands](/docs/content/islands) — Blume auto-enables React only for the pages that use them, so the core theme stays JavaScript-free everywhere else.
|
|
||||||
|
|
||||||
## Where can I deploy it?
|
|
||||||
|
|
||||||
Anywhere. `blume build` outputs static HTML by default, which you can serve from any static host or CDN — Vercel, Netlify, Cloudflare Pages, GitHub Pages, S3, or your own server. Server-only features (Ask AI, the MCP server, on-demand rendering) switch the build to a server function through an adapter for Vercel, Node, Netlify, or Cloudflare. See [Deployment](/docs/deployment).
|
|
||||||
|
|
||||||
## Does search need a hosted service?
|
|
||||||
|
|
||||||
No. [Orama](/docs/configuration/search) builds a local index that works in both dev and production with nothing to host or pay for. For very large sites, [Pagefind](/docs/configuration/search) is one flag away. Either way the index ships as part of your site.
|
|
||||||
|
|
||||||
## How do I customize the look?
|
|
||||||
|
|
||||||
Start with [theme tokens](/docs/configuration/theming) — accent color, fonts, radius, and a `theme.css` for anything else Tailwind can express. Go further by [overriding built-in components](/docs/configuration/customization) or adding [custom pages](/docs/configuration/customization#custom-pages). When you want the Astro project itself, [`blume eject`](/docs/reference/cli) hands you a standalone app that still uses the `blume` package.
|
|
||||||
|
|
||||||
## Why is oxfmt / Ultracite collapsing my directives?
|
|
||||||
|
|
||||||
If you format your Markdown with [Ultracite](https://www.ultracite.ai) (which runs oxlint + [oxfmt](https://oxc.rs)) — as Blume itself does — you may notice that container directives get flattened onto a single line after a format pass:
|
|
||||||
|
|
||||||
```md
|
|
||||||
:::note
|
|
||||||
Regenerate the project with blume dev.
|
|
||||||
:::
|
|
||||||
```
|
|
||||||
|
|
||||||
becomes
|
|
||||||
|
|
||||||
```md
|
|
||||||
:::note Regenerate the project with blume dev. :::
|
|
||||||
```
|
|
||||||
|
|
||||||
Once the opening `:::note` fence is joined to the prose, it's no longer a directive, so it renders as literal text instead of a [callout](/docs/content/syntax#callouts).
|
|
||||||
|
|
||||||
### Why it happens
|
|
||||||
|
|
||||||
This is a bug in oxfmt's Markdown formatter (inherited from Prettier's Markdown printer — see [prettier/prettier#19040](https://github.com/prettier/prettier/pull/19040)). When it wraps prose, it treats the `:::` fence lines as ordinary text and joins them with the adjacent line, breaking the directive. It affects every container directive type — `:::note`, `:::tip`, `:::info`, `:::warning`, `:::danger`, `:::success`.
|
|
||||||
|
|
||||||
We reported it upstream in [oxc-project/oxc#24096](https://github.com/oxc-project/oxc/issues/24096); until it's fixed there, the patch below is the workaround.
|
|
||||||
|
|
||||||
### The fix
|
|
||||||
|
|
||||||
Patch oxfmt so it preserves the line break that sits directly against a `:::` fence. Blume ships the same fix in its own repo, and you can apply it in any project.
|
|
||||||
|
|
||||||
1. Save the patch as `patches/oxfmt@0.61.0.patch`:
|
|
||||||
|
|
||||||
```diff patches/oxfmt@0.61.0.patch
|
|
||||||
diff --git a/dist/markdown-ZuiQU4Xe.js b/dist/markdown-ZuiQU4Xe.js
|
|
||||||
index 566b9e6d27f36061d64b93736e238e871e1ee2b2..82d0595acc010807c2939fc4a1717dde887a8555 100644
|
|
||||||
--- a/dist/markdown-ZuiQU4Xe.js
|
|
||||||
+++ b/dist/markdown-ZuiQU4Xe.js
|
|
||||||
@@ -4875,7 +4875,43 @@ function lu(e, t, r) {
|
|
||||||
case "sentence": return Oh(e, r);
|
|
||||||
case "word": return t.parser !== "mdx" ? zh(e, t) : Uh(e);
|
|
||||||
case "whitespace": {
|
|
||||||
- let { next: a } = e, u = a && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(a.value) && !NE(e) && !(t.proseWrap === "preserve" && RE(e)) ? "never" : t.proseWrap;
|
|
||||||
+ let { next: a, previous: oxfmtFencePrev } = e;
|
|
||||||
+ // Preserve line breaks that sit directly against a `:::` container
|
|
||||||
+ // directive fence, so `proseWrap: "never"` keeps the opening/closing
|
|
||||||
+ // fence on their own lines instead of joining them into the prose (which
|
|
||||||
+ // breaks the directive). Ordinary prose still wraps per proseWrap.
|
|
||||||
+ // See prettier/prettier#19040.
|
|
||||||
+ let oxfmtIsFence = (w) => w != null && typeof w.value === "string" && w.value.startsWith(":::");
|
|
||||||
+ // A titled directive (`:::warning[Heads up]`) parses its `[title]` as a
|
|
||||||
+ // linkReference between two sentence nodes at the paragraph level: the
|
|
||||||
+ // fence word ends the sentence before the reference, and the body's
|
|
||||||
+ // leading newline opens the sentence after it. So when this whitespace
|
|
||||||
+ // starts its sentence, climb to the paragraph and check whether the two
|
|
||||||
+ // preceding siblings are a (link) reference and a sentence ending in a
|
|
||||||
+ // `:::` fence word.
|
|
||||||
+ let oxfmtPrevIsTitledFence = !1;
|
|
||||||
+ if (oxfmtFencePrev == null && e.index === 0 && e.grandparent != null && Array.isArray(e.grandparent.children)) {
|
|
||||||
+ let oxfmtSibs = e.grandparent.children, oxfmtSentIdx = oxfmtSibs.indexOf(e.parent);
|
|
||||||
+ if (oxfmtSentIdx >= 2) {
|
|
||||||
+ let oxfmtLink = oxfmtSibs[oxfmtSentIdx - 1], oxfmtBefore = oxfmtSibs[oxfmtSentIdx - 2];
|
|
||||||
+ let oxfmtLastWord = oxfmtBefore && oxfmtBefore.type === "sentence" && Array.isArray(oxfmtBefore.children) ? oxfmtBefore.children[oxfmtBefore.children.length - 1] : null;
|
|
||||||
+ oxfmtPrevIsTitledFence = oxfmtLink != null && (oxfmtLink.type === "linkReference" || oxfmtLink.type === "link") && oxfmtIsFence(oxfmtLastWord);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // The plain-markdown parser keeps a titled fence's `[title]` as literal
|
|
||||||
+ // words, so the whole directive is one sentence. For a newline
|
|
||||||
+ // whitespace, walk back to the start of its visual line within the
|
|
||||||
+ // sentence; a line led by a `:::` word is a fence whose break must stay.
|
|
||||||
+ if (!oxfmtPrevIsTitledFence && e.node.value.includes("\n") && e.parent != null && Array.isArray(e.parent.children)) {
|
|
||||||
+ let oxfmtLineFirst = null;
|
|
||||||
+ for (let oxfmtJ = e.index - 1; oxfmtJ >= 0; oxfmtJ--) {
|
|
||||||
+ let oxfmtSib = e.parent.children[oxfmtJ];
|
|
||||||
+ if (oxfmtSib.type === "whitespace" && typeof oxfmtSib.value === "string" && oxfmtSib.value.includes("\n")) break;
|
|
||||||
+ oxfmtLineFirst = oxfmtSib;
|
|
||||||
+ }
|
|
||||||
+ oxfmtPrevIsTitledFence = oxfmtIsFence(oxfmtLineFirst);
|
|
||||||
+ }
|
|
||||||
+ let u = oxfmtIsFence(oxfmtFencePrev) || oxfmtPrevIsTitledFence || oxfmtIsFence(a) ? "preserve" : a && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(a.value) && !NE(e) && !(t.proseWrap === "preserve" && RE(e)) ? "never" : t.proseWrap;
|
|
||||||
return ou(e, n.value, u, !1, t);
|
|
||||||
}
|
|
||||||
case "emphasis": {
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Register it with your package manager's `patchedDependencies`. With Bun or pnpm, add to `package.json`:
|
|
||||||
|
|
||||||
```json package.json
|
|
||||||
{
|
|
||||||
"patchedDependencies": {
|
|
||||||
"oxfmt@0.61.0": "patches/oxfmt@0.61.0.patch"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Reinstall so the patch is applied:
|
|
||||||
|
|
||||||
```package-install
|
|
||||||
bun install
|
|
||||||
```
|
|
||||||
|
|
||||||
:::warning[Version-pinned]
|
|
||||||
The patch targets a specific oxfmt build — its diff references a file whose name is hashed per release (`dist/markdown-*.js`). When you bump oxfmt, regenerate the patch (e.g. `bun patch oxfmt`) or check whether the upstream fix has landed and the patch is no longer needed.
|
|
||||||
:::
|
|
||||||
Reference in New Issue
Block a user