MOC-Leetcode-算法思想
全部是 dataview 感知的
二分法
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/二分法")
sort file.ctime双指针
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/双指针")
sort file.ctime滑动窗口
- 关键是明确出窗条件,只有知道什么时候出窗,才能做对
- 可以每次都入窗,但是不一定每次都出窗,判断一下在考虑是不是需要出窗。
- 知道出窗什么时候停止,这往往和什么时候出窗有关系,但不一定。
- 窗口内的信息不一定只能用一个变量来记录。譬如,对于字符串,可以使用
[0]\*26的列表记录出现次数,或者利用need和need_cnt来快速记录什么是需要和不需要的,以及当前需要多少个。
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/滑动窗口")
sort file.ctimeDFS
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/DFS")
sort file.ctimeBFS
- 使用时一般需要先判断输入的二叉树是不是空,而DFS一般不用。
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/BFS")
sort file.ctime前缀和
疑问:前缀和数组第i位的和到底包不包含数组中第i位数字?
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/前缀和")
sort file.ctime动态规划
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/动态规划")
sort file.ctime贪心
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/贪心")
sort file.ctime回溯
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/回溯")
sort file.ctime并查集
table
level AS "难度",
tags AS "Tags",
review_times AS "Review"
from "300_CSNotes/302_Leetcode/302_atom"
where contains(file.tags, "算法/并查集")
sort file.ctime