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

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

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

从解法上来说，多是：

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

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

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

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

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