File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ zhs branch:
47
47
48
48
### 算法思维 🦁
49
49
50
+ - [ 每日一题简记] ( ./advanced_algorithm/daily.md )
50
51
- [ 递归思维] ( ./advanced_algorithm/recursion.md )
51
52
- [ 滑动窗口思想] ( ./advanced_algorithm/slide_window.md )
52
53
- [ 二叉搜索树] ( ./advanced_algorithm/binary_search_tree.md )
Original file line number Diff line number Diff line change
1
+ # 每日一题
2
+
3
+ ## 预处理思想
4
+ 预处理,减少后续时间复杂度。
5
+
6
+ KMP算法、高级字符串匹配,都是先对pattern进行预处理,减少matching time。
7
+
8
+ [ 适龄的朋友-好友请求总数] ( https://leetcode-cn.com/problems/friends-of-appropriate-ages/ )
9
+ 计数排序 + 前缀和的解法,前缀和也是一种快速求分段和的预处理!线性时间,实现获取任意分段和。
Original file line number Diff line number Diff line change @@ -209,6 +209,16 @@ class Solution:
209
209
- left 右移
210
210
- 求结果
211
211
212
+ 双指针不止一种,可以在for x 循环中按需更新left 和/或 right:
213
+ ``` python
214
+ left = right = 0 # 当x和其中某侧重合时,可以只有另一侧
215
+ for x in range (n):
216
+ while left_condition: # if necessary
217
+ left += 1
218
+ while right_condition: # if necessary
219
+ right += 1
220
+ ```
221
+
212
222
## 练习
213
223
214
224
- [ ] [ minimum-window-substring] ( https://leetcode-cn.com/problems/minimum-window-substring/ )
You can’t perform that action at this time.
0 commit comments