# 第六章 - 高频考题（困难）

困难难度题目从类型上说多是：

* 图
* 设计题
* 游戏场景题目
* 中等题目的 follow up

从解法上来说，多是：

* 图算法
* 动态规划
* 二分法
* DFS & BFS
* 状态压缩
* 剪枝

从逻辑上说， 要么就是非常难想到，要么就是非常难写代码。 这里我总结了几个技巧：

1. 看题目的数据范围， 看能否暴力模拟
2. 暴力枚举所有可能的算法往上套，比如图的题目。
3. 总结和记忆解题模板，减少解题压力

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

* [0004. 寻找两个正序数组的中位数](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/4.median-of-two-sorted-arrays)
* [0023. 合并 K 个升序链表](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/23.merge-k-sorted-lists)
* [0025. K 个一组翻转链表](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/25.reverse-nodes-in-k-groups)
* [0030. 串联所有单词的子串](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/30.substring-with-concatenation-of-all-words)
* [0032. 最长有效括号](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/32.longest-valid-parentheses)
* [0042. 接雨水](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/42.trapping-rain-water)
* [0052. N 皇后 II](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/52.n-queens-ii)
* [0057. 插入区间](https://github.com/azl397985856/leetcode/tree/3ab9bbe39c9b383ac9e532915e5169124d6ab686/collections/problems/57.insert-interval.md)
* [0084. 柱状图中最大的矩形](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/84.largest-rectangle-in-histogram)
* [0085. 最大矩形](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/85.maximal-rectangle)
* [0124. 二叉树中的最大路径和](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/124.binary-tree-maximum-path-sum)
* [0128. 最长连续序列](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/128.longest-consecutive-sequence)
* [0140. 单词拆分 II](https://github.com/azl397985856/leetcode/tree/3ab9bbe39c9b383ac9e532915e5169124d6ab686/collections/problems/140.word-break-ii.md)
* [0145. 二叉树的后序遍历](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/145.binary-tree-postorder-traversal)
* [0212. 单词搜索 II](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/broken-reference)
* [0239. 滑动窗口最大值](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/239.sliding-window-maximum)
* [0295. 数据流的中位数](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/295.find-median-from-data-stream)
* [0297. 二叉树的序列化与反序列化](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/297.serialize-and-deserialize-binary-tree) 91
* [0301. 删除无效的括号](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/301.remove-invalid-parentheses)
* [0312. 戳气球](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/312.burst-balloons)
* [330. 按要求补齐数组](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/330.patching-array)
* [0335. 路径交叉](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/335.self-crossing)
* [0460. LFU 缓存](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/460.lfu-cache)
* [0472. 连接词](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/472.concatenated-words)
* [0488. 祖玛游戏](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/488.zuma-game)
* [0493. 翻转对](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/493.reverse-pairs)
* [0715. Range 模块](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/715.range-module)
* [0768. 最多能完成排序的块 II](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/768.max-chunks-to-make-sorted-ii) 91
* [0887. 鸡蛋掉落](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/887.super-egg-drop)
* [0895. 最大频率栈](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/895.maximum-frequency-stack)
* [0975. 奇偶跳](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/975.odd-even-jump)
* [1032. 字符流](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/1032.stream-of-characters)
* [1168. 水资源分配优化](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/1168.optimize-water-distribution-in-a-village)
* [1203. 项目管理](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/1203.sort-items-by-groups-respecting-dependencies)
* [1255. 得分最高的单词集合](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/1255.maximum-score-words-formed-by-letters)
* [1345. 跳跃游戏 IV](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/1435.jump-game-iv)
* [1449. 数位成本和为目标值的最大数字](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/1449.form-largest-integer-with-digits-that-add-up-to-target)
* [5640. 与数组中元素的最大异或值](https://leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/hard/5640.maximum-xor-with-an-element-from-array)
