@@ -24,7 +24,7 @@ image::images/quick-sort-01.gif[{image_attr}]
24
24
25
25
== 解题范式
26
26
27
- . Two Pointers
27
+ . xref:0000-02-two-pointer.adoc[ Two Pointer 双指针]
28
28
.. Pair with Target Sum (easy)
29
29
.. Find Non-Duplicate Number Instances (easy)
30
30
.. Squaring a Sorted Array (easy)
@@ -36,49 +36,49 @@ image::images/quick-sort-01.gif[{image_attr}]
36
36
.. Problem Challenge 1: Quadruple Sum to Target (medium)
37
37
.. Problem Challenge 2: Comparing Strings containing Backspaces (medium)
38
38
.. Problem Challenge 3: Minimum Window Sort (medium)
39
- . Fast & Slow Pointers
39
+ . xref:0000-03-fast-slow-pointers.adoc[ Fast & Slow Pointers 快慢指针]
40
40
.. LinkedList Cycle (easy)
41
41
.. Middle of the LinkedList (easy)
42
42
.. Start of LinkedList Cycle (medium)
43
43
.. Happy Number (medium)
44
44
.. Problem Challenge 1: Palindrome LinkedList (medium)
45
45
.. Problem Challenge 2: Rearrange a LinkedList (medium)
46
46
.. Problem Challenge 3: Cycle in a Circular Array (hard)
47
- . Sliding Window
47
+ . xref:0000-01-sliding-window.adoc[ Sliding Window 滑动窗口]
48
48
.. Maximum Sum Subarray of Size K (easy)
49
49
.. Smallest Subarray With a Greater Sum (easy)
50
50
.. Longest Substring with K Distinct Characters (medium)
51
51
.. Fruits into Baskets (medium)
52
52
.. Longest Substring with Same Letters after Replacement (hard)
53
53
.. Longest Subarray with Ones after Replacement (hard)
54
54
.. Problem Challenge 1: Permutation in a String (hard)
55
- .. Problem Challenge 2: String Anagrams (hard)
55
+ .. Problem Challenge 2: String Anagrams (hard)
56
56
.. Problem Challenge 3: Smallest Window containing Substring (hard)
57
57
.. Problem Challenge 4: Words Concatenation (hard)
58
- . Merge Intervals
58
+ . xref:0000-04-merge-intervals.adoc[ Merge Intervals 区间合并]
59
59
.. Merge Intervals (medium)
60
60
.. Insert Interval (medium)
61
61
.. Intervals Intersection (medium)
62
62
.. Conflicting Appointments (medium)
63
63
.. Problem Challenge 1: Minimum Meeting Rooms (hard)
64
64
.. Problem Challenge 2: Maximum CPU Load (hard)
65
65
.. Problem Challenge 3: Employee Free Time (hard)
66
- . Cyclic Sort
66
+ . xref:0000-05-cyclic-sort.adoc[ Cyclic Sort 循环排序]
67
67
.. Cyclic Sort (easy)
68
68
.. Find the Missing Number (easy)
69
69
.. Find all Missing Numbers (easy)
70
70
.. Find the Duplicate Number (easy)
71
71
.. Find all Duplicate Numbers (easy)
72
72
.. Problem Challenge 1: Find the Corrupt Pair (easy)
73
- .. Problem Challenge 2: Find the Smallest Missing Positive Number (medium)
74
- .. Problem Challenge 3: Find the First K Missing Positive Numbers (hard)
75
- . In-place Reversal of a Linked List
73
+ .. Problem Challenge 2: xref:0041-first-missing-positive.adoc[41. First Missing Positive]
74
+ .. Problem Challenge 3: xref:1539-kth-missing-positive-number.adoc[1539. Kth Missing Positive Number]
75
+ . xref:0000-06-reversed-list.adoc[ In-place Reversal of a LinkedList 原地链表翻转]
76
76
.. Reverse a LinkedList (easy)
77
77
.. Reverse a Sub-list (medium)
78
78
.. Reverse every K-element Sub-list (medium)
79
79
.. Problem Challenge 1: Reverse alternating K-element Sub-list (medium)
80
80
.. Problem Challenge 2: Rotate a LinkedList (medium)
81
- . Stacks
81
+ . xref:0000-data-structure-stack.adoc[Stack 栈]
82
82
.. Operations on Stack
83
83
.. Implementing Stack Data Structure
84
84
.. Applications of Stack
@@ -88,7 +88,7 @@ image::images/quick-sort-01.gif[{image_attr}]
88
88
.. Problem 4: Next Greater Element
89
89
.. Problem 5: Sorting a Stack
90
90
.. Problem 6: Simplify Path
91
- . Monotonic Stack
91
+ . xref:0000-23-monotonic-stack.adoc[ Monotonic Stack 单调栈]
92
92
.. Remove Nodes From Linked List (medium)
93
93
.. Remove All Adjacent Duplicates In String (easy)
94
94
.. Next Greater Element (easy)
@@ -103,7 +103,7 @@ image::images/quick-sort-01.gif[{image_attr}]
103
103
.. Problem 3: Maximum Number of Balloons (easy)
104
104
.. Problem 4: Longest Palindrome(easy)
105
105
.. Problem 5: Ransom Note (easy)
106
- . Tree Breadth First Search
106
+ . xref:0000-07-breadth-first-search.adoc[ Breadth First Search 广度优先搜索]
107
107
.. Binary Tree Level Order Traversal (easy)
108
108
.. Reverse Level Order Traversal (easy)
109
109
.. Zigzag Traversal (medium)
@@ -113,15 +113,15 @@ image::images/quick-sort-01.gif[{image_attr}]
113
113
.. Connect Level Order Siblings (medium)
114
114
.. Problem Challenge 1: Connect All Level Order Siblings (medium)
115
115
.. Problem Challenge 2: Right View of a Binary Tree (easy)
116
- . Tree Depth First Search
116
+ . xref:0000-08-depth-first-search.adoc[ Depth First Search 深度优先搜索]
117
117
.. Binary Tree Path Sum (easy)
118
118
.. All Paths for a Sum (medium)
119
119
.. Sum of Path Numbers (medium)
120
120
.. Path With Given Sequence (medium)
121
121
.. Count Paths for a Sum (medium)
122
122
.. Problem Challenge 1: Tree Diameter (medium)
123
123
.. Problem Challenge 2: Path with Maximum Sum (hard)
124
- . Graphs
124
+ . xref:0000-data-structure-graph.adoc[Graph 图]
125
125
.. Graph Representations
126
126
.. Graph as an Abstract Data Type (ADT)
127
127
.. Graph Traversal - Depth First Search(DFS)
@@ -137,12 +137,12 @@ image::images/quick-sort-01.gif[{image_attr}]
137
137
.. Problem Challenge 1 (easy)
138
138
.. Problem Challenge 2 (medium)
139
139
.. Problem Challenge 3 (medium)
140
- . Two Heaps
140
+ . xref:0000-09-two-heaps.adoc[ Two Heaps 双堆]
141
141
.. Find the Median of a Number Stream (medium)
142
142
.. Sliding Window Median (hard)
143
143
.. Maximize Capital (hard)
144
144
.. Problem Challenge 1: Next Interval (hard)
145
- . Subsets
145
+ . xref:0000-10-subsets.adoc[ Subsets 子集]
146
146
.. Subsets (easy)
147
147
.. Subsets With Duplicates (easy)
148
148
.. Permutations (medium)
@@ -152,7 +152,7 @@ image::images/quick-sort-01.gif[{image_attr}]
152
152
.. Problem Challenge 1: Evaluate Expression (hard)
153
153
.. Problem Challenge 2: Structurally Unique Binary Search Trees (hard)
154
154
.. Problem Challenge 3: Count of Structurally Unique Binary Search Trees (hard)
155
- . Modified Binary Search
155
+ . xref:0000-11-modified-binary-search.adoc[ Modified Binary Search 改造过的二分搜索]
156
156
.. Order-agnostic Binary Search (easy)
157
157
.. Ceiling of a Number (medium)
158
158
.. Next Letter (medium)
@@ -168,7 +168,7 @@ image::images/quick-sort-01.gif[{image_attr}]
168
168
.. Two Single Numbers (medium)
169
169
.. Complement of Base 10 Number (medium)
170
170
.. Problem Challenge 1: Flip and Invert an Image (hard)
171
- . Top 'K' Elements
171
+ . xref:0000-12-top-k-elements.adoc[ Top 'K' Elements 顶端 K 元素]
172
172
.. Top 'K' Numbers (easy)
173
173
.. Kth Smallest Number (easy)
174
174
.. 'K' Closest Points to the Origin (easy)
@@ -183,41 +183,41 @@ image::images/quick-sort-01.gif[{image_attr}]
183
183
.. Problem Challenge 1: Rearrange String K Distance Apart (hard)
184
184
.. Problem Challenge 2: Scheduling Tasks (hard)
185
185
.. Problem Challenge 3: Frequency Stack (hard)
186
- . Greedy Algorithms
186
+ . xref:0000-16-greedy.adoc[ Greedy Algorithms 贪心算法]
187
187
.. Valid Palindrome II (easy)
188
188
.. Maximum Length of Pair Chain (medium)
189
189
.. Minimum Add to Make Parentheses Valid (medium)
190
190
.. Remove Duplicate Letters (medium)
191
191
.. Largest Palindromic Number (medium)
192
192
.. Removing Minimum and Maximum From Array (medium)
193
- . 0/1 Knapsack ( Dynamic Programming)
193
+ . xref:0000-21-dynamic-programming.adoc[ Dynamic Programming 动态规划]
194
194
.. 0/1 Knapsack (medium)
195
195
.. Equal Subset Sum Partition (medium)
196
196
.. Subset Sum (medium)
197
197
.. Minimum Subset Sum Difference (hard)
198
198
.. Problem Challenge 1: Count of Subset Sum (hard)
199
199
.. Problem Challenge 2: Target Sum (hard)
200
- . Backtracking
200
+ . xref:0000-15-backtrack.adoc[ Backtracking 回溯]
201
201
.. Combination Sum (medium)
202
202
.. Word Search (medium)
203
203
.. Factor Combinations (medium)
204
204
.. Split a String Into the Max Number of Unique Substrings (medium)
205
205
.. Sudoku Solver (hard)
206
- . Trie
206
+ . xref:0000-26-trie.adoc[ Trie 前缀树]
207
207
.. Implement Trie (Prefix Tree) (medium)
208
208
.. Index Pairs of a String (easy)
209
209
.. Design Add and Search Words Data Structure (medium)
210
210
.. Extra Characters in a String (medium)
211
211
.. Search Suggestions System (medium)
212
- . Topological Sort (Graph)
212
+ . xref:0000-14-topological-sort.adoc[ Topological Sort (Graph) 拓扑排序]
213
213
.. Topological Sort (medium)
214
214
.. Tasks Scheduling (medium)
215
215
.. Tasks Scheduling Order (medium)
216
216
.. All Tasks Scheduling Orders (hard)
217
217
.. Alien Dictionary (hard)
218
218
.. Problem Challenge 1: Reconstructing a Sequence (hard)
219
219
.. Problem Challenge 2: Minimum Height Trees (hard)
220
- . Union Find
220
+ . xref:0000-22-union-find-set.adoc[ Union Find Set 查并集]
221
221
.. Redundant Connection (medium)
222
222
.. Number of Provinces (medium)
223
223
.. Is Graph Bipartite? (medium)
@@ -227,22 +227,25 @@ image::images/quick-sort-01.gif[{image_attr}]
227
227
.. 132 Pattern (medium)
228
228
.. My Calendar I (medium)
229
229
.. Longest Continuous Subarray (medium)
230
- . Prefix Sum
230
+ . xref:0000-25-prefix-sum.adoc[ Prefix Sum 前缀和]
231
231
.. Find the Middle Index in Array (easy)
232
232
.. Left and Right Sum Differences (easy)
233
233
.. Maximum Size Subarray Sum Equals k (medium)
234
234
.. Binary Subarrays With Sum (medium)
235
235
.. Subarray Sums Divisible by K (medium)
236
236
.. Sum of Absolute Differences in a Sorted Array (medium)
237
237
.. Subarray Sum Equals K (medium)
238
+ . xref:0000-24-difference-array.adoc[Difference Array 差分数组]
238
239
. Multi-threaded
239
240
.. Same Tree (medium)
240
241
.. Invert Binary Tree (medium)
241
242
.. Binary Search Tree Iterator (medium)
243
+ . xref:0000-13-k-way-merge.adoc[K-way merge 多路归并]
242
244
243
245
244
246
== 参考资料
245
247
246
248
. https://www.designgurus.io/course/grokking-the-coding-interview[Grokking the Coding Interview Patterns^]
247
249
. https://leetcode.ca/all/1650.html[Leetcode 1650. Lowest Common Ancestor of a Binary Tree III^] -- 会员题目可以在这里查找。
248
250
. https://github.com/doocs/leetcode[doocs/leetcode: 🔥LeetCode solutions in any programming language | 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解^] -- 也可以在这里找题目
251
+ . https://github.com/Chanda-Abdul/Several-Coding-Patterns-for-Solving-Data-Structures-and-Algorithms-Problems-during-Interviews[Several Coding Patterns for Solving Data Structures and Algorithms Problems during Interviews^] -- 多种解题范式总结
0 commit comments