Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,23 @@ Our **AI Ontology Analyzer** processes the entire knowledge graph — API Kernel

> **"Don't memorize 200 problems. Master 10 patterns."**

Each API Kernel has a dedicated pattern guide with **base template**, **variations**, and **copy-paste ready code**.

| API Kernel | Guide | Problems |
|:-----------|:-----:|:---------|
| `SubstringSlidingWindow` | [📖](docs/patterns/sliding_window.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
| `TwoPointersTraversal` | [📖](docs/patterns/two_pointers.md) | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
| `GridBFSMultiSource` | *soon* | LeetCode 994, 286, 542 |
| `BacktrackingExploration` | *soon* | LeetCode 51, 52, 46, 78 |
| `KWayMerge` | *soon* | LeetCode 23, 21, 88 |
| `BinarySearchBoundary` | *soon* | LeetCode 4, 33, 34, 35 |
Each pattern provides **two learning paths**:

| Path | Purpose | Best For |
|:-----|:--------|:---------|
| 💡 **Intuition** | Understand the "why" through stories and visual explanations | First-time learners, building mental models |
| 🛠️ **Templates** | Production-ready implementations with problem-specific variations | Interview prep, quick reference |

| API Kernel | Learning Resources | Problems |
|:-----------|:-------------------|:---------|
| `SubstringSlidingWindow` | 💡 [Intuition](docs/patterns/sliding_window/intuition.md) · 🛠️ [Templates](docs/patterns/sliding_window/templates.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
| `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 |
| `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 |
| `GridBFSMultiSource` | *coming soon* | LeetCode 994, 286, 542 |
| `KWayMerge` | *coming soon* | LeetCode 23, 21, 88 |
| `BinarySearchBoundary` | *coming soon* | LeetCode 4, 33, 34, 35 |
| `LinkedListInPlaceReversal` | *coming soon* | LeetCode 25, 206, 92 |
| `MonotonicStack` | *coming soon* | LeetCode 84, 85, 496 |

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

Expand Down
19 changes: 13 additions & 6 deletions README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,23 @@ scripts\run_tests.bat 0001_two_sum

> **「不要死背 200 道題。掌握 10 個模式。」**

每個 API 核心都有專屬的模式指南,包含**基礎模板**、**變體**和**可直接複製的程式碼**。
每個模式提供**兩條學習路徑**:

| API 核心 | 指南 | 題目 |
|:---------|:----:|:-----|
| `SubstringSlidingWindow` | [📖](docs/patterns/sliding_window.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
| `TwoPointersTraversal` | [📖](docs/patterns/two_pointers.md) | LeetCode 1, 11, 15, 16, 21, 26, 27, 75, 88, 125, 141, 142, 167, 202, 283, 680, 876 |
| 路徑 | 目的 | 適合對象 |
|:-----|:-----|:---------|
| 💡 **直覺理解** | 透過故事和視覺化解釋理解「為什麼」 | 初學者、建立心智模型 |
| 🛠️ **模板** | 生產級實作與問題專屬變體 | 面試準備、快速參考 |

| API 核心 | 學習資源 | 題目 |
|:---------|:---------|:-----|
| `SubstringSlidingWindow` | 💡 [直覺理解](docs/patterns/sliding_window/intuition.md) · 🛠️ [模板](docs/patterns/sliding_window/templates.md) | LeetCode 3, 76, 159, 209, 340, 438, 567 |
| `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 |
| `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 |
| `GridBFSMultiSource` | *即將推出* | LeetCode 994, 286, 542 |
| `BacktrackingExploration` | *即將推出* | LeetCode 51, 52, 46, 78 |
| `KWayMerge` | *即將推出* | LeetCode 23, 21, 88 |
| `BinarySearchBoundary` | *即將推出* | LeetCode 4, 33, 34, 35 |
| `LinkedListInPlaceReversal` | *即將推出* | LeetCode 25, 206, 92 |
| `MonotonicStack` | *即將推出* | LeetCode 84, 85, 496 |

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

Expand Down
23 changes: 18 additions & 5 deletions docs/patterns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,27 @@ This directory contains comprehensive documentation for each **API Kernel** and

---

## How to Use This Documentation

Each pattern provides **two learning paths** to help you master the concepts:

| Path | Purpose | Best For |
|------|---------|----------|
| 💡 **Intuition** | Understand the "why" through stories and visual explanations | First-time learners, building mental models |
| 🛠️ **Templates** | Production-ready implementations with problem-specific variations | Interview prep, quick reference |

**Recommended approach**: Start with Intuition to build understanding, then use Templates for implementation.

---

## Available Pattern Guides

| API Kernel | Document | Description | Problems |
|------------|----------|-------------|----------|
| `SubstringSlidingWindow` | [sliding_window.md](sliding_window.md) | Dynamic window over sequences | LeetCode 3, 76, 159, 209, 340, 438, 567 |
| `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 |
| API Kernel | Learning Resources | Description | Problems |
|------------|-------------------|-------------|----------|
| `SubstringSlidingWindow` | 💡 [Intuition](sliding_window/intuition.md) · 🛠️ [Templates](sliding_window/templates.md) | Dynamic window over sequences | LeetCode 3, 76, 159, 209, 340, 438, 567 |
| `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 |
| `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 |
| `GridBFSMultiSource` | *coming soon* | Multi-source BFS on grids | LeetCode 994, 286, 542 |
| `BacktrackingExploration` | *coming soon* | Exhaustive search with pruning | LeetCode 51, 52, 46, 78 |
| `KWayMerge` | *coming soon* | Merge K sorted sequences | LeetCode 23, 21, 88 |
| `BinarySearchBoundary` | *coming soon* | Binary search boundaries | LeetCode 4, 33, 34, 35 |
| `LinkedListInPlaceReversal` | *coming soon* | In-place linked list reversal | LeetCode 25, 206, 92 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ This document presents the **canonical backtracking template** and all its major
15. [Pruning Techniques](#15-pruning-techniques)
16. [Pattern Comparison Table](#16-pattern-comparison-table)
17. [When to Use Backtracking](#17-when-to-use-backtracking)
18. [Template Quick Reference](#18-template-quick-reference)
18. [LeetCode Problem Mapping](#18-leetcode-problem-mapping)
19. [Template Quick Reference](#19-template-quick-reference)

---

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

---

---

## 2. Base Template: Permutations (LeetCode 46)

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

---

## 18. Template Quick Reference
## 18. LeetCode Problem Mapping

| Sub-Pattern | Problems |
|-------------|----------|
| **Permutation Enumeration** | 46. Permutations, 47. Permutations II |
| **Subset/Combination** | 78. Subsets, 90. Subsets II, 77. Combinations |
| **Target Search** | 39. Combination Sum, 40. Combination Sum II, 216. Combination Sum III |
| **Constraint Satisfaction** | 51. N-Queens, 52. N-Queens II, 37. Sudoku Solver |
| **String Partitioning** | 131. Palindrome Partitioning, 93. Restore IP Addresses, 140. Word Break II |
| **Grid/Path Search** | 79. Word Search, 212. Word Search II |

---

## 19. Template Quick Reference

### 18.1 Permutation Template
### 19.1 Permutation Template

```python
def permute(nums):
Expand All @@ -1318,7 +1334,7 @@ def permute(nums):
return results
```

### 18.2 Subset/Combination Template
### 19.2 Subset/Combination Template

```python
def subsets(nums):
Expand All @@ -1336,7 +1352,7 @@ def subsets(nums):
return results
```

### 18.3 Target Sum Template
### 19.3 Target Sum Template

```python
def combination_sum(candidates, target):
Expand All @@ -1358,7 +1374,7 @@ def combination_sum(candidates, target):
return results
```

### 18.4 Grid Search Template
### 19.4 Grid Search Template

```python
def grid_search(grid, word):
Expand Down Expand Up @@ -1388,22 +1404,13 @@ def grid_search(grid, word):
if backtrack(r, c, 0):
return True
return False

```

---

## LeetCode Problem Mapping

| Sub-Pattern | Problems |
|-------------|----------|
| **Permutation Enumeration** | 46. Permutations, 47. Permutations II |
| **Subset/Combination** | 78. Subsets, 90. Subsets II, 77. Combinations |
| **Target Search** | 39. Combination Sum, 40. Combination Sum II, 216. Combination Sum III |
| **Constraint Satisfaction** | 51. N-Queens, 52. N-Queens II, 37. Sudoku Solver |
| **String Partitioning** | 131. Palindrome Partitioning, 93. Restore IP Addresses, 140. Word Break II |
| **Grid/Path Search** | 79. Word Search, 212. Word Search II |

---

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


*Document generated for NeetCode Practice Framework — API Kernel: BacktrackingExploration*
Loading