算法复习规划
没问题!这张“回忆版”真题确实含金量极高,直接暴露了老师的**“LeetCode 原题搬运工”**属性。
根据你提供的真题分析,我为你整理了这份带直达链接的必刷题单。既然时间紧(10天),请优先刷标有 ⭐ 的题目,那是核心母题。
🎯 第一部分:分治策略 (Divide & Conquer)
去年考点:LC 162 寻找峰值。重点在于二分查找的变体和归并思想。
- ⭐ LC 162. 寻找峰值 (去年原题,利用“爬坡”性质二分)
https://leetcode.cn/problems/find-peak-element/ - ⭐ LC 33. 搜索旋转排序数组 (必考!二分法的最高频考题,比峰值更经典)
https://leetcode.cn/problems/search-in-rotated-sorted-array/ - LC 34. 在排序数组中查找元素的第一个和最后一个位置 (考察二分的边界处理)
https://leetcode.cn/problems/find-first-and-last-position-of-element-in-sorted-array/ - ⭐ LC 215. 数组中的第K个最大元素 (必考!快速选择算法 QuickSelect,分治思想的典型应用)
https://leetcode.cn/problems/kth-largest-element-in-an-array/ - LC 53. 最大子数组和 (分治法解法是教材经典案例)
https://leetcode.cn/problems/maximum-subarray/ - LC 169. 多数元素 (摩尔投票法最快,但分治法也是经典解)
https://leetcode.cn/problems/majority-element/ - LC 240. 搜索二维矩阵 II (利用矩阵有序性的减治思想)
https://leetcode.cn/problems/search-a-2d-matrix-ii/ - LC 4. 寻找两个正序数组的中位数 (Hard,二分法的终极应用,冲满绩必看)
https://leetcode.cn/problems/median-of-two-sorted-arrays/ - ⭐ LC 23. 合并K个升序链表 (归并排序思想的扩展)
https://leetcode.cn/problems/merge-k-sorted-lists/ - 剑指 Offer 51. 数组中的逆序对 (归并排序过程中的统计,分治经典)
https://leetcode.cn/problems/shu-zu-zhong-de-ni-xu-dui-lcof/
🎒 第二部分:动态规划 (Dynamic Programming)
去年考点:LC 70 爬楼梯。重点在于背包问题和子序列。
- ⭐ LC 70. 爬楼梯 (去年原题,热身)
https://leetcode.cn/problems/climbing-stairs/ - ⭐ LC 322. 零钱兑换 (必考!完全背包问题的变体,求最少硬币数)
https://leetcode.cn/problems/coin-change/ - ⭐ LC 300. 最长递增子序列 (LIS) (必考!经典 $O(n^2)$ 解法)
https://leetcode.cn/problems/longest-increasing-subsequence/ - ⭐ LC 1143. 最长公共子序列 (LCS) (必考!二维 DP 的教科书题目)
https://leetcode.cn/problems/longest-common-subsequence/ - LC 198. 打家劫舍 (线性 DP,不能选相邻元素)
https://leetcode.cn/problems/house-robber/ - LC 64. 最小路径和 (矩阵网格 DP,从左上走到右下)
https://leetcode.cn/problems/minimum-path-sum/ - LC 62. 不同路径 (也是网格 DP,求路径数量)
https://leetcode.cn/problems/unique-paths/ - ⭐ LC 416. 分割等和子集 (必考!0-1 背包变体。注意:这题就是“两个工人分配任务时间相等”的 DP 解法)
https://leetcode.cn/problems/partition-equal-subset-sum/ - LC 72. 编辑距离 (Hard,两个字符串变换的最少操作数)
https://leetcode.cn/problems/edit-distance/ - LC 5. 最长回文子串 (区间 DP 或 中心扩散)
https://leetcode.cn/problems/longest-palindromic-substring/
🌲 第三部分:回溯法 (Backtracking)
去年考点:LC 282 添加运算符。说明老师看重状态树的剪枝和构建。
- ⭐ LC 282. 给表达式添加运算符 (去年原题,重点复习乘法优先级处理)
https://leetcode.cn/problems/expression-add-operators/ - ⭐ LC 46. 全排列 (必考!回溯法最基本的模板)
https://leetcode.cn/problems/permutations/ - ⭐ LC 78. 子集 (必考!找所有子集,经典模板)
https://leetcode.cn/problems/subsets/ - ⭐ LC 51. N皇后 (必考!教材经典案例,必须会手写)
https://leetcode.cn/problems/n-queens/ - LC 39. 组合总和 (数字可重复使用,考察去重)
https://leetcode.cn/problems/combination-sum/ - LC 22. 括号生成 (生成合法的括号组合)
https://leetcode.cn/problems/generate-parentheses/ - LC 79. 单词搜索 (在矩阵中找字符串,DFS 回溯)
https://leetcode.cn/problems/word-search/ - LC 93. 复原 IP 地址 (字符串切割问题,和 LC 282 很像)
https://leetcode.cn/problems/restore-ip-addresses/ - ⭐ LC 1723. 完成所有工作的最短时间 (去年第2题“任务分配”的原型,必看)
https://leetcode.cn/problems/find-minimum-time-to-finish-all-jobs/ - LC 131. 分割回文串 (先判断回文,再回溯分割)
https://leetcode.cn/problems/palindrome-partitioning/
🍪 第四部分:贪心算法 (Greedy)
考点预测:区间调度和简单的分配问题。
- ⭐ LC 55. 跳跃游戏 (能否到达终点,贪心经典)
https://leetcode.cn/problems/jump-game/ - LC 45. 跳跃游戏 II (最少跳几步,覆盖范围更新)
https://leetcode.cn/problems/jump-game-ii/ - ⭐ LC 435. 无重叠区间 (必考!区间调度问题,按结束时间排序)
https://leetcode.cn/problems/non-overlapping-intervals/ - ⭐ LC 455. 分发饼干 (最简单的贪心,排序后一一匹配)
https://leetcode.cn/problems/assign-cookies/ - LC 134. 加油站 (环形数组的贪心,局部最优推全局)
https://leetcode.cn/problems/gas-station/ - LC 406. 根据身高重建队列 (两个维度的贪心,先排一个维度)
https://leetcode.cn/problems/queue-reconstruction-by-height/ - LC 179. 最大数 (自定义排序规则
(a+b).compareTo(b+a))
https://leetcode.cn/problems/largest-number/
💡 针对你情况的特别提醒
关于“任务分配” (去年第2题):
- 一定要看 LC 416 (分割等和子集)。如果题目问“能不能把任务均分给两个人”,这就是 DP。
- 一定要看 LC 1723。如果题目问“两人干完所有活,最少需要多少时间”,这就是 回溯 + 剪枝。
- 这两道题很容易混,考前务必区分清楚。
关于“LC 282 添加运算符” (去年第4题):
- 这是一道 Hard,说明老师不怕出难题。
- 如果觉得这题太难写不出,优先把 LC 46 全排列 和 LC 51 N皇后 背熟。考试时如果遇到难题写不出来,写出基本的回溯框架(for循环+递归+回退),通常能拿 40%-60% 的步骤分。
建议现在的动作:
先打开 LC 33 (搜索旋转数组) 和 LC 416 (分割等和子集),这两道题最能代表“分治”和“DP”的核心考法。你需要我先讲讲 LC 33 的思路吗?这题有坑。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Ling的个人博客!
