# 第五章 - 高频考题（中等）

中等题目是力扣比例最大的部分，因此这部分我的题解也是最多的。 大家不要太过追求难题，先把中等难度题目做熟了再说。

这部分的题目要不需要我们挖掘题目的内含信息， 将其抽象成简单题目。 要么是一些写起来比较麻烦的题目， 一些人编码能力不行就挂了。因此大家一定要自己做， 即使看了题解”会了“，也要自己码一遍。自己不亲自写一遍，里面的细节永远不知道。

以下是我列举的经典题目（带 91 字样的表示出自 **91 天学算法**活动）：

* [面试题 17.09. 第 k 个数](/leetcode-solution/medium/get-kth-magic-number-lcci.md)
* [面试题 17.23. 最大黑方阵](/leetcode-solution/medium/max-black-square-lcci.md)🆕
* [0002. 两数相加](/leetcode-solution/medium/2.add-two-numbers.md)
* [0003. 无重复字符的最长子串](/leetcode-solution/medium/3.longest-substring-without-repeating-characters.md)
* [0005. 最长回文子串](/leetcode-solution/medium/5.longest-palindromic-substring.md)
* [0011. 盛最多水的容器](/leetcode-solution/medium/11.container-with-most-water.md)
* [0015. 三数之和](/leetcode-solution/medium/15.3sum.md)
* [0017. 电话号码的字母组合](/leetcode-solution/medium/17.letter-combinations-of-a-phone-number.md)
* [0019. 删除链表的倒数第 N 个节点](/leetcode-solution/medium/19.removenthnodefromendoflist.md)
* [0022. 括号生成](/leetcode-solution/medium/22.generate-parentheses.md)
* [0024. 两两交换链表中的节点](/leetcode-solution/medium/24.swapnodesinpairs.md)
* [0029. 两数相除](/leetcode-solution/medium/29.divide-two-integers.md)
* [0031. 下一个排列](/leetcode-solution/medium/31.next-permutation.md)
* [0033. 搜索旋转排序数组](/leetcode-solution/medium/33.search-in-rotated-sorted-array.md)
* [0039. 组合总和](/leetcode-solution/medium/39.combination-sum.md)
* [0040. 组合总和 II](/leetcode-solution/medium/40.combination-sum-ii.md)
* [0046. 全排列](/leetcode-solution/medium/46.permutations.md)
* [0047. 全排列 II](/leetcode-solution/medium/47.permutations-ii.md)
* [0048. 旋转图像](/leetcode-solution/medium/48.rotate-image.md)
* [0049. 字母异位词分组](/leetcode-solution/medium/49.group-anagrams.md)
* [0050. Pow(x, n)](/leetcode-solution/medium/50.pow-x-n.md)
* [0055. 跳跃游戏](/leetcode-solution/medium/55.jump-game.md)
* [0056. 合并区间](/leetcode-solution/medium/56.merge-intervals.md)
* [0060. 第 k 个排列](/leetcode-solution/medium/60.permutation-sequence.md)
* [0061. 旋转链表](/leetcode-solution/medium/61.rotate-list.md) 91
* [0062. 不同路径](/leetcode-solution/medium/62.unique-paths.md)
* [0073. 矩阵置零](/leetcode-solution/medium/73.set-matrix-zeroes.md)
* [0075. 颜色分类](/leetcode-solution/medium/75.sort-colors.md)
* [0078. 子集](/leetcode-solution/medium/78.subsets.md)
* [0079. 单词搜索](/leetcode-solution/medium/79.word-search.md)
* [0080. 删除排序数组中的重复项 II](/leetcode-solution/medium/80.remove-duplicates-from-sorted-array-ii.md)
* [0086. 分隔链表](/leetcode-solution/medium/86.partition-list.md)
* [0090. 子集 II](/leetcode-solution/medium/90.subsets-ii.md)
* [0091. 解码方法](/leetcode-solution/medium/91.decode-ways.md)
* [0092. 反转链表 II](/leetcode-solution/medium/92.reverse-linked-list-ii.md)
* [0094. 二叉树的中序遍历](/leetcode-solution/medium/94.binary-tree-inorder-traversal.md)
* [0095. 不同的二叉搜索树 II](/leetcode-solution/medium/95.unique-binary-search-trees-ii.md)
* [0096. 不同的二叉搜索树](/leetcode-solution/medium/96.unique-binary-search-trees.md)
* [0098. 验证二叉搜索树](/leetcode-solution/medium/98.validate-binary-search-tree.md)
* [0102. 二叉树的层序遍历](/leetcode-solution/medium/102.binary-tree-level-order-traversal.md)
* [0103. 二叉树的锯齿形层次遍历](/leetcode-solution/medium/103.binary-tree-zigzag-level-order-traversal.md)
* [0113. 路径总和 II](/leetcode-solution/medium/113.path-sum-ii.md)
* [0129. 求根到叶子节点数字之和](/leetcode-solution/medium/129.sum-root-to-leaf-numbers.md)
* [0130. 被围绕的区域](/leetcode-solution/medium/130.surrounded-regions.md)
* [0131. 分割回文串](/leetcode-solution/medium/131.palindrome-partitioning.md)
* [0139. 单词拆分](/leetcode-solution/medium/139.word-break.md)
* [0144. 二叉树的前序遍历](/leetcode-solution/medium/144.binary-tree-preorder-traversal.md)
* [0147. 对链表进行插入排序](/leetcode-solution/medium/147.insertion-sort-list.md)
* [0150. 逆波兰表达式求值](/leetcode-solution/medium/150.evaluate-reverse-polish-notation.md)
* [0152. 乘积最大子数组](/leetcode-solution/medium/152.maximum-product-subarray.md)
* [0199. 二叉树的右视图](/leetcode-solution/medium/199.binary-tree-right-side-view.md)
* [0200. 岛屿数量](/leetcode-solution/medium/200.number-of-islands.md)
* [0201. 数字范围按位与](/leetcode-solution/medium/201.bitwise-and-of-numbers-range.md)
* [0208. 实现 Trie (前缀树)](/leetcode-solution/medium/208.implement-trie-prefix-tree.md)
* [0209. 长度最小的子数组](/leetcode-solution/medium/209.minimum-size-subarray-sum.md)
* [0211. 添加与搜索单词 \* 数据结构设计](/leetcode-solution/medium/211.add-and-search-word-data-structure-design.md)
* [0215. 数组中的第 K 个最大元素](/leetcode-solution/medium/215.kth-largest-element-in-an-array.md)
* [0221. 最大正方形](/leetcode-solution/medium/221.maximal-square.md)
* [0227. 基本计算器 II](/leetcode-solution/medium/227.basic-calculator-ii.md)🆕
* [0229. 求众数 II](/leetcode-solution/medium/229.majority-element-ii.md)
* [0230. 二叉搜索树中第 K 小的元素](/leetcode-solution/medium/230.kth-smallest-element-in-a-bst.md)
* [0236. 二叉树的最近公共祖先](/leetcode-solution/medium/236.lowest-common-ancestor-of-a-binary-tree.md)
* [0238. 除自身以外数组的乘积](/leetcode-solution/medium/238.product-of-array-except-self.md)
* [0240. 搜索二维矩阵 II](/leetcode-solution/medium/240.search-a-2-d-matrix-ii.md)
* [0279. 完全平方数](/leetcode-solution/medium/279.perfect-squares.md)
* [0309. 最佳买卖股票时机含冷冻期](/leetcode-solution/medium/309.best-time-to-buy-and-sell-stock-with-cooldown.md)
* [0322. 零钱兑换](/leetcode-solution/medium/322.coin-change.md)
* [0328. 奇偶链表](/leetcode-solution/medium/328.odd-even-linked-list.md)
* [0334. 递增的三元子序列](/leetcode-solution/medium/334.increasing-triplet-subsequence.md)
* [0337. 打家劫舍 III](/leetcode-solution/medium/337.house-robber-iii.md)
* [0343. 整数拆分](/leetcode-solution/medium/343.integer-break.md)
* [0365. 水壶问题](/leetcode-solution/medium/365.water-and-jug-problem.md)
* [0378. 有序矩阵中第 K 小的元素](/leetcode-solution/medium/378.kth-smallest-element-in-a-sorted-matrix.md)
* [0380. 常数时间插入、删除和获取随机元素](/leetcode-solution/medium/380.insert-delete-getrandom-o1.md)
* [0394. 字符串解码](/leetcode-solution/medium/394.decode-string.md) 91
* [0416. 分割等和子集](/leetcode-solution/medium/416.partition-equal-subset-sum.md)
* [0445. 两数相加 II](/leetcode-solution/medium/445.add-two-numbers-ii.md)
* [0454. 四数相加 II](/leetcode-solution/medium/454.4-sum-ii.md)
* [0464. 我能赢么](/leetcode-solution/medium/464.can-i-win.md)
* [0494. 目标和](/leetcode-solution/medium/494.target-sum.md)
* [0516. 最长回文子序列](/leetcode-solution/medium/516.longest-palindromic-subsequence.md)
* [0513. 找树左下角的值](/leetcode-solution/medium/513.find-bottom-left-tree-value.md) 91
* [0518. 零钱兑换 II](/leetcode-solution/medium/518.coin-change-2.md)
* [0547. 朋友圈](broken://pages/-MJpDGjN-ap6YcO0XaW_)
* [0560. 和为 K 的子数组](/leetcode-solution/medium/560.subarray-sum-equals-k.md)
* [0609. 在系统中查找重复文件](/leetcode-solution/medium/609.find-duplicate-file-in-system.md)
* [0611. 有效三角形的个数](/leetcode-solution/medium/611.valid-triangle-number.md)
* [0686. 重复叠加字符串匹配](/leetcode-solution/medium/686.repeated-string-match.md)
* [0718. 最长重复子数组](/leetcode-solution/medium/718.maximum-length-of-repeated-subarray.md)
* [0754. 到达终点数字](/leetcode-solution/medium/754.reach-a-number.md)
* [0785. 判断二分图](/leetcode-solution/medium/785.is-graph-bipartite.md)
* [0816. 模糊坐标](/leetcode-solution/medium/816.ambiguous-coordinates.md)
* [0820. 单词的压缩编码](/leetcode-solution/medium/820.short-encoding-of-words.md)
* [0875. 爱吃香蕉的珂珂](/leetcode-solution/medium/875.koko-eating-bananas.md)
* [0877. 石子游戏](/leetcode-solution/medium/877.stone-game.md)
* [0886. 可能的二分法](/leetcode-solution/medium/886.possible-bipartition.md)
* [0900. RLE 迭代器](/leetcode-solution/medium/900.rle-iterator.md)
* [0911. 在线选举](/leetcode-solution/medium/911.online-election.md)
* [0912. 排序数组](/leetcode-solution/medium/912.sort-an-array.md)
* [0935. 骑士拨号器](/leetcode-solution/medium/935.knight-dialer.md)
* [0978. 最长湍流子数组](/leetcode-solution/medium/978.longest-turbulent-subarray.md)
* [0987. 二叉树的垂序遍历](/leetcode-solution/medium/987.vertical-order-traversal-of-a-binary-tree.md) 91
* [1011. 在 D 天内送达包裹的能力](/leetcode-solution/medium/1011.capacity-to-ship-packages-within-d-days.md)
* [1014. 最佳观光组合](/leetcode-solution/medium/1014.best-sightseeing-pair.md)
* [1015. 可被 K 整除的最小整数](/leetcode-solution/medium/1015.smallest-integer-divisible-by-k.md)
* [1019. 链表中的下一个更大节点](/leetcode-solution/medium/1019.next-greater-node-in-linked-list.md)
* [1020. 飞地的数量](/leetcode-solution/medium/1020.number-of-enclaves.md)
* [1023. 驼峰式匹配](/leetcode-solution/medium/1023.camelcase-matching.md)
* [1031. 两个非重叠子数组的最大和](/leetcode-solution/medium/1031.maximum-sum-of-two-non-overlapping-subarrays.md)
* [1104. 二叉树寻路](/leetcode-solution/medium/1104.path-in-zigzag-labelled-binary-tree.md)
* [1131.绝对值表达式的最大值](/leetcode-solution/medium/1131.maximum-of-absolute-value-expression.md)
* [1186. 删除一次得到子数组最大和](/leetcode-solution/medium/1186.maximum-subarray-sum-with-one-deletion.md)
* [1218. 最长定差子序列](/leetcode-solution/medium/1218.longest-arithmetic-subsequence-of-given-difference.md)
* [1227. 飞机座位分配概率](/leetcode-solution/medium/1227.airplane-seat-assignment-probability.md)
* [1261. 在受污染的二叉树中查找元素](/leetcode-solution/medium/1261.find-elements-in-a-contaminated-binary-tree.md)
* [1262. 可被三整除的最大和](/leetcode-solution/medium/1262.greatest-sum-divisible-by-three.md)
* [1297. 子串的最大出现次数](/leetcode-solution/medium/1297.maximum-number-of-occurrences-of-a-substring.md)
* [1310. 子数组异或查询](/leetcode-solution/medium/1310.xor-queries-of-a-subarray.md)
* [1334. 阈值距离内邻居最少的城市](/leetcode-solution/medium/1334.find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.md)
* [1371.每个元音包含偶数次的最长子字符串](/leetcode-solution/medium/1371.find-the-longest-substring-containing-vowels-in-even-counts.md)
* [1381. 设计一个支持增量操作的栈](/leetcode-solution/medium/1381.design-a-stack-with-increment-operation.md) 91
* [1558. 得到目标数组的最少函数调用次数](/leetcode-solution/medium/1558.minimum-numbers-of-function-calls-to-make-target-array.md)
* [1574. 删除最短的子数组使剩余数组有序](/leetcode-solution/medium/1574.shortest-subarray-to-be-removed-to-make-array-sorted.md)
* [1631. 最小体力消耗路径](/leetcode-solution/medium/1631.path-with-minimum-effort.md)
* [1658. 将 x 减到 0 的最小操作数](/leetcode-solution/medium/1658.minimum-operations-to-reduce-x-to-zero.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/medium.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
