Skip to content

Commit 3df08d1

Browse files
authored
Merge pull request #47 from lufftw/feat/pattern-dual-track-docs
2 parents f48275d + 9b34c7d commit 3df08d1

35 files changed

+3300
-44
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,23 @@ Our **AI Ontology Analyzer** processes the entire knowledge graph — API Kernel
343343

344344
> **"Don't memorize 200 problems. Master 10 patterns."**
345345
346-
Each API Kernel has a dedicated pattern guide with **base template**, **variations**, and **copy-paste ready code**.
347-
348-
| API Kernel | Guide | Problems |
349-
|:-----------|:-----:|:---------|
350-
| `SubstringSlidingWindow` | [📖](docs/patterns/sliding_window.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
351-
| `TwoPointersTraversal` | [📖](docs/patterns/two_pointers.md) | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
352-
| `GridBFSMultiSource` | *soon* | LeetCode 994, 286, 542 |
353-
| `BacktrackingExploration` | *soon* | LeetCode 51, 52, 46, 78 |
354-
| `KWayMerge` | *soon* | LeetCode 23, 21, 88 |
355-
| `BinarySearchBoundary` | *soon* | LeetCode 4, 33, 34, 35 |
346+
Each pattern provides **two learning paths**:
347+
348+
| Path | Purpose | Best For |
349+
|:-----|:--------|:---------|
350+
| 💡 **Intuition** | Understand the "why" through stories and visual explanations | First-time learners, building mental models |
351+
| 🛠️ **Templates** | Production-ready implementations with problem-specific variations | Interview prep, quick reference |
352+
353+
| API Kernel | Learning Resources | Problems |
354+
|:-----------|:-------------------|:---------|
355+
| `SubstringSlidingWindow` | 💡 [Intuition](docs/patterns/sliding_window/intuition.md) · 🛠️ [Templates](docs/patterns/sliding_window/templates.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
356+
| `TwoPointersTraversal` | 💡 [Intuition](docs/patterns/two_pointers/intuition.md) · 🛠️ [Templates](docs/patterns/two_pointers/templates.md) | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
357+
| `BacktrackingExploration` | 💡 [Intuition](docs/patterns/backtracking_exploration/intuition.md) · 🛠️ [Templates](docs/patterns/backtracking_exploration/templates.md) | LeetCode 39, 40, 46, 47, 51, 77, 78, 79, 90, 93, 131, 216 |
358+
| `GridBFSMultiSource` | *coming soon* | LeetCode 994, 286, 542 |
359+
| `KWayMerge` | *coming soon* | LeetCode 23, 21, 88 |
360+
| `BinarySearchBoundary` | *coming soon* | LeetCode 4, 33, 34, 35 |
361+
| `LinkedListInPlaceReversal` | *coming soon* | LeetCode 25, 206, 92 |
362+
| `MonotonicStack` | *coming soon* | LeetCode 84, 85, 496 |
356363

357364
👉 **[View All Pattern Guides →](docs/patterns/README.md)**
358365

README_zh-TW.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,23 @@ scripts\run_tests.bat 0001_two_sum
343343

344344
> **「不要死背 200 道題。掌握 10 個模式。」**
345345
346-
每個 API 核心都有專屬的模式指南,包含**基礎模板****變體****可直接複製的程式碼**
346+
每個模式提供**兩條學習路徑**
347347

348-
| API 核心 | 指南 | 題目 |
349-
|:---------|:----:|:-----|
350-
| `SubstringSlidingWindow` | [📖](docs/patterns/sliding_window.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
351-
| `TwoPointersTraversal` | [📖](docs/patterns/two_pointers.md) | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
348+
| 路徑 | 目的 | 適合對象 |
349+
|:-----|:-----|:---------|
350+
| 💡 **直覺理解** | 透過故事和視覺化解釋理解「為什麼」 | 初學者、建立心智模型 |
351+
| 🛠️ **模板** | 生產級實作與問題專屬變體 | 面試準備、快速參考 |
352+
353+
| API 核心 | 學習資源 | 題目 |
354+
|:---------|:---------|:-----|
355+
| `SubstringSlidingWindow` | 💡 [直覺理解](docs/patterns/sliding_window/intuition.md) · 🛠️ [模板](docs/patterns/sliding_window/templates.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
356+
| `TwoPointersTraversal` | 💡 [直覺理解](docs/patterns/two_pointers/intuition.md) · 🛠️ [模板](docs/patterns/two_pointers/templates.md) | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
357+
| `BacktrackingExploration` | 💡 [直覺理解](docs/patterns/backtracking_exploration/intuition.md) · 🛠️ [模板](docs/patterns/backtracking_exploration/templates.md) | LeetCode 39, 40, 46, 47, 51, 77, 78, 79, 90, 93, 131, 216 |
352358
| `GridBFSMultiSource` | *即將推出* | LeetCode 994, 286, 542 |
353-
| `BacktrackingExploration` | *即將推出* | LeetCode 51, 52, 46, 78 |
354359
| `KWayMerge` | *即將推出* | LeetCode 23, 21, 88 |
355360
| `BinarySearchBoundary` | *即將推出* | LeetCode 4, 33, 34, 35 |
361+
| `LinkedListInPlaceReversal` | *即將推出* | LeetCode 25, 206, 92 |
362+
| `MonotonicStack` | *即將推出* | LeetCode 84, 85, 496 |
356363

357364
👉 **[查看所有模式指南 →](docs/patterns/README.md)**
358365

docs/patterns/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@ This directory contains comprehensive documentation for each **API Kernel** and
77

88
---
99

10+
## How to Use This Documentation
11+
12+
Each pattern provides **two learning paths** to help you master the concepts:
13+
14+
| Path | Purpose | Best For |
15+
|------|---------|----------|
16+
| 💡 **Intuition** | Understand the "why" through stories and visual explanations | First-time learners, building mental models |
17+
| 🛠️ **Templates** | Production-ready implementations with problem-specific variations | Interview prep, quick reference |
18+
19+
**Recommended approach**: Start with Intuition to build understanding, then use Templates for implementation.
20+
21+
---
22+
1023
## Available Pattern Guides
1124

12-
| API Kernel | Document | Description | Problems |
13-
|------------|----------|-------------|----------|
14-
| `SubstringSlidingWindow` | [sliding_window.md](sliding_window.md) | Dynamic window over sequences | LeetCode 3, 76, 159, 209, 340, 438, 567 |
15-
| `TwoPointersTraversal` | [two_pointers.md](two_pointers.md) | Two pointer traversal patterns | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
25+
| API Kernel | Learning Resources | Description | Problems |
26+
|------------|-------------------|-------------|----------|
27+
| `SubstringSlidingWindow` | 💡 [Intuition](sliding_window/intuition.md) · 🛠️ [Templates](sliding_window/templates.md) | Dynamic window over sequences | LeetCode 3, 76, 159, 209, 340, 438, 567 |
28+
| `TwoPointersTraversal` | 💡 [Intuition](two_pointers/intuition.md) · 🛠️ [Templates](two_pointers/templates.md) | Two pointer traversal patterns | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
29+
| `BacktrackingExploration` | 💡 [Intuition](backtracking_exploration/intuition.md) · 🛠️ [Templates](backtracking_exploration/templates.md) | Exhaustive search with pruning | LeetCode 39, 40, 46, 47, 51, 77, 78, 79, 90, 93, 131, 216 |
1630
| `GridBFSMultiSource` | *coming soon* | Multi-source BFS on grids | LeetCode 994, 286, 542 |
17-
| `BacktrackingExploration` | *coming soon* | Exhaustive search with pruning | LeetCode 51, 52, 46, 78 |
1831
| `KWayMerge` | *coming soon* | Merge K sorted sequences | LeetCode 23, 21, 88 |
1932
| `BinarySearchBoundary` | *coming soon* | Binary search boundaries | LeetCode 4, 33, 34, 35 |
2033
| `LinkedListInPlaceReversal` | *coming soon* | In-place linked list reversal | LeetCode 25, 206, 92 |
File renamed without changes.

docs/patterns/backtracking_exploration_templates.md renamed to docs/patterns/backtracking_exploration/templates.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ This document presents the **canonical backtracking template** and all its major
2626
15. [Pruning Techniques](#15-pruning-techniques)
2727
16. [Pattern Comparison Table](#16-pattern-comparison-table)
2828
17. [When to Use Backtracking](#17-when-to-use-backtracking)
29-
18. [Template Quick Reference](#18-template-quick-reference)
29+
18. [LeetCode Problem Mapping](#18-leetcode-problem-mapping)
30+
19. [Template Quick Reference](#19-template-quick-reference)
3031

3132
---
3233

@@ -117,6 +118,8 @@ Backtracking algorithms typically have exponential or factorial complexity becau
117118

118119
---
119120

121+
---
122+
120123
## 2. Base Template: Permutations (LeetCode 46)
121124

122125
> **Problem**: Given an array of distinct integers, return all possible permutations.
@@ -1291,9 +1294,22 @@ Is the problem asking for ALL solutions?
12911294

12921295
---
12931296

1294-
## 18. Template Quick Reference
1297+
## 18. LeetCode Problem Mapping
1298+
1299+
| Sub-Pattern | Problems |
1300+
|-------------|----------|
1301+
| **Permutation Enumeration** | 46. Permutations, 47. Permutations II |
1302+
| **Subset/Combination** | 78. Subsets, 90. Subsets II, 77. Combinations |
1303+
| **Target Search** | 39. Combination Sum, 40. Combination Sum II, 216. Combination Sum III |
1304+
| **Constraint Satisfaction** | 51. N-Queens, 52. N-Queens II, 37. Sudoku Solver |
1305+
| **String Partitioning** | 131. Palindrome Partitioning, 93. Restore IP Addresses, 140. Word Break II |
1306+
| **Grid/Path Search** | 79. Word Search, 212. Word Search II |
1307+
1308+
---
1309+
1310+
## 19. Template Quick Reference
12951311

1296-
### 18.1 Permutation Template
1312+
### 19.1 Permutation Template
12971313

12981314
```python
12991315
def permute(nums):
@@ -1318,7 +1334,7 @@ def permute(nums):
13181334
return results
13191335
```
13201336

1321-
### 18.2 Subset/Combination Template
1337+
### 19.2 Subset/Combination Template
13221338

13231339
```python
13241340
def subsets(nums):
@@ -1336,7 +1352,7 @@ def subsets(nums):
13361352
return results
13371353
```
13381354

1339-
### 18.3 Target Sum Template
1355+
### 19.3 Target Sum Template
13401356

13411357
```python
13421358
def combination_sum(candidates, target):
@@ -1358,7 +1374,7 @@ def combination_sum(candidates, target):
13581374
return results
13591375
```
13601376

1361-
### 18.4 Grid Search Template
1377+
### 19.4 Grid Search Template
13621378

13631379
```python
13641380
def grid_search(grid, word):
@@ -1388,22 +1404,13 @@ def grid_search(grid, word):
13881404
if backtrack(r, c, 0):
13891405
return True
13901406
return False
1407+
13911408
```
13921409

1393-
---
13941410

1395-
## LeetCode Problem Mapping
1396-
1397-
| Sub-Pattern | Problems |
1398-
|-------------|----------|
1399-
| **Permutation Enumeration** | 46. Permutations, 47. Permutations II |
1400-
| **Subset/Combination** | 78. Subsets, 90. Subsets II, 77. Combinations |
1401-
| **Target Search** | 39. Combination Sum, 40. Combination Sum II, 216. Combination Sum III |
1402-
| **Constraint Satisfaction** | 51. N-Queens, 52. N-Queens II, 37. Sudoku Solver |
1403-
| **String Partitioning** | 131. Palindrome Partitioning, 93. Restore IP Addresses, 140. Word Break II |
1404-
| **Grid/Path Search** | 79. Word Search, 212. Word Search II |
14051411

14061412
---
14071413

1408-
*Document generated for NeetCode Practice Framework — API Kernel: BacktrackingExploration*
14091414

1415+
1416+
*Document generated for NeetCode Practice Framework — API Kernel: BacktrackingExploration*

0 commit comments

Comments
 (0)