---
comments: true
edit_url: https://github.com/doocs/leetcode/edit/main/lcci/README.md
---

# 《程序员面试金典(第 6 版)》系列

本书是原谷歌资深面试官的经验之作,帮助了许多想要加入脸书、苹果、谷歌等 IT 名企的求职者拿到 Dream offer。本专题的 100+ 编程面试题是在原书基础上精心挑选出来的,帮助你轻松应战 IT 名企技术面试。

[English Version](/lcci/README_EN.md)

## 题解

列表所有题解均由 [开源社区 Doocs](https://github.com/doocs) 贡献者提供,正在完善中,欢迎贡献你的题解!

快速搜索题号、题解、标签等,请善用 <kbd>Control</kbd> + <kbd>F</kbd>(或者 <kbd>Command</kbd> + <kbd>F</kbd>)。

| 题号                                                                        | 题解                                                                             | 标签                                          | 难度 |
| --------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------- | ---- |
| [01.01](https://leetcode.cn/problems/is-unique-lcci)                        | [判定字符是否唯一](/lcci/01.01.Is%20Unique/README.md)                            | `数组`                                        | 简单 |
| [01.02](https://leetcode.cn/problems/check-permutation-lcci)                | [判定是否互为字符重排](/lcci/01.02.Check%20Permutation/README.md)                | `数组`,`字符串`                               | 简单 |
| [01.03](https://leetcode.cn/problems/string-to-url-lcci)                    | [URL 化](/lcci/01.03.String%20to%20URL/README.md)                                | `字符串`                                      | 简单 |
| [01.04](https://leetcode.cn/problems/palindrome-permutation-lcci)           | [回文排列](/lcci/01.04.Palindrome%20Permutation/README.md)                       | `哈希表`,`字符串`                             | 简单 |
| [01.05](https://leetcode.cn/problems/one-away-lcci)                         | [一次编辑](/lcci/01.05.One%20Away/README.md)                                     | `字符串`,`动态规划`                           | 中等 |
| [01.06](https://leetcode.cn/problems/compress-string-lcci)                  | [字符串压缩](/lcci/01.06.Compress%20String/README.md)                            | `字符串`                                      | 简单 |
| [01.07](https://leetcode.cn/problems/rotate-matrix-lcci)                    | [旋转矩阵](/lcci/01.07.Rotate%20Matrix/README.md)                                | `数组`                                        | 中等 |
| [01.08](https://leetcode.cn/problems/zero-matrix-lcci)                      | [零矩阵](/lcci/01.08.Zero%20Matrix/README.md)                                    | `数组`                                        | 中等 |
| [01.09](https://leetcode.cn/problems/string-rotation-lcci)                  | [字符串轮转](/lcci/01.09.String%20Rotation/README.md)                            | `字符串`                                      | 简单 |
| [02.01](https://leetcode.cn/problems/remove-duplicate-node-lcci)            | [移除重复节点](/lcci/02.01.Remove%20Duplicate%20Node/README.md)                  | `链表`                                        | 简单 |
| [02.02](https://leetcode.cn/problems/kth-node-from-end-of-list-lcci)        | [返回倒数第 k 个节点](/lcci/02.02.Kth%20Node%20From%20End%20of%20List/README.md) | `链表`,`双指针`                               | 简单 |
| [02.03](https://leetcode.cn/problems/delete-middle-node-lcci)               | [删除中间节点](/lcci/02.03.Delete%20Middle%20Node/README.md)                     | `链表`                                        | 简单 |
| [02.04](https://leetcode.cn/problems/partition-list-lcci)                   | [分割链表](/lcci/02.04.Partition%20List/README.md)                               | `链表`,`双指针`                               | 中等 |
| [02.05](https://leetcode.cn/problems/sum-lists-lcci)                        | [链表求和](/lcci/02.05.Sum%20Lists/README.md)                                    | `链表`,`数学`                                 | 中等 |
| [02.06](https://leetcode.cn/problems/palindrome-linked-list-lcci)           | [回文链表](/lcci/02.06.Palindrome%20Linked%20List/README.md)                     | `链表`                                        | 简单 |
| [02.07](https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci) | [链表相交](/lcci/02.07.Intersection%20of%20Two%20Linked%20Lists/README.md)       | `链表`                                        | 简单 |
| [02.08](https://leetcode.cn/problems/linked-list-cycle-lcci)                | [环路检测](/lcci/02.08.Linked%20List%20Cycle/README.md)                          | `链表`                                        | 中等 |
| [03.01](https://leetcode.cn/problems/three-in-one-lcci)                     | [三合一](/lcci/03.01.Three%20in%20One/README.md)                                 | `设计`                                        | 简单 |
| [03.02](https://leetcode.cn/problems/min-stack-lcci)                        | [栈的最小值](/lcci/03.02.Min%20Stack/README.md)                                  | `栈`                                          | 简单 |
| [03.03](https://leetcode.cn/problems/stack-of-plates-lcci)                  | [堆盘子](/lcci/03.03.Stack%20of%20Plates/README.md)                              | `设计`                                        | 中等 |
| [03.04](https://leetcode.cn/problems/implement-queue-using-stacks-lcci)     | [化栈为队](/lcci/03.04.Implement%20Queue%20using%20Stacks/README.md)             | `栈`                                          | 简单 |
| [03.05](https://leetcode.cn/problems/sort-of-stacks-lcci)                   | [栈排序](/lcci/03.05.Sort%20of%20Stacks/README.md)                               | `设计`                                        | 中等 |
| [03.06](https://leetcode.cn/problems/animal-shelter-lcci)                   | [动物收容所](/lcci/03.06.Animal%20Shelter/README.md)                             | `设计`                                        | 简单 |
| [04.01](https://leetcode.cn/problems/route-between-nodes-lcci)              | [节点间通路](/lcci/04.01.Route%20Between%20Nodes/README.md)                      | `图`                                          | 中等 |
| [04.02](https://leetcode.cn/problems/minimum-height-tree-lcci)              | [最小高度树](/lcci/04.02.Minimum%20Height%20Tree/README.md)                      | `树`,`深度优先搜索`                           | 简单 |
| [04.03](https://leetcode.cn/problems/list-of-depth-lcci)                    | [特定深度节点链表](/lcci/04.03.List%20of%20Depth/README.md)                      | `树`,`广度优先搜索`                           | 中等 |
| [04.04](https://leetcode.cn/problems/check-balance-lcci)                    | [检查平衡性](/lcci/04.04.Check%20Balance/README.md)                              | `树`,`深度优先搜索`                           | 简单 |
| [04.05](https://leetcode.cn/problems/legal-binary-search-tree-lcci)         | [合法二叉搜索树](/lcci/04.05.Legal%20Binary%20Search%20Tree/README.md)           | `树`,`深度优先搜索`                           | 中等 |
| [04.06](https://leetcode.cn/problems/successor-lcci)                        | [后继者](/lcci/04.06.Successor/README.md)                                        | `树`,`深度优先搜索`                           | 中等 |
| [04.08](https://leetcode.cn/problems/first-common-ancestor-lcci)            | [首个共同祖先](/lcci/04.08.First%20Common%20Ancestor/README.md)                  | `树`                                          | 中等 |
| [04.09](https://leetcode.cn/problems/bst-sequences-lcci)                    | [二叉搜索树序列](/lcci/04.09.BST%20Sequences/README.md)                          | `树`,`动态规划`                               | 困难 |
| [04.10](https://leetcode.cn/problems/check-subtree-lcci)                    | [检查子树](/lcci/04.10.Check%20SubTree/README.md)                                | `树`                                          | 中等 |
| [04.12](https://leetcode.cn/problems/paths-with-sum-lcci)                   | [求和路径](/lcci/04.12.Paths%20with%20Sum/README.md)                             | `树`,`深度优先搜索`                           | 中等 |
| [05.01](https://leetcode.cn/problems/insert-into-bits-lcci)                 | [插入](/lcci/05.01.Insert%20Into%20Bits/README.md)                               | `位运算`                                      | 简单 |
| [05.02](https://leetcode.cn/problems/bianry-number-to-string-lcci)          | [二进制数转字符串](/lcci/05.02.Bianry%20Number%20to%20String/README.md)          | `字符串`                                      | 中等 |
| [05.03](https://leetcode.cn/problems/reverse-bits-lcci)                     | [翻转数位](/lcci/05.03.Reverse%20Bits/README.md)                                 | `位运算`                                      | 简单 |
| [05.04](https://leetcode.cn/problems/closed-number-lcci)                    | [下一个数](/lcci/05.04.Closed%20Number/README.md)                                | `位运算`                                      | 中等 |
| [05.06](https://leetcode.cn/problems/convert-integer-lcci)                  | [整数转换](/lcci/05.06.Convert%20Integer/README.md)                              | `位运算`                                      | 简单 |
| [05.07](https://leetcode.cn/problems/exchange-lcci)                         | [配对交换](/lcci/05.07.Exchange/README.md)                                       | `位运算`                                      | 简单 |
| [05.08](https://leetcode.cn/problems/draw-line-lcci)                        | [绘制直线](/lcci/05.08.Draw%20Line/README.md)                                    | `数组`                                        | 中等 |
| [08.01](https://leetcode.cn/problems/three-steps-problem-lcci)              | [三步问题](/lcci/08.01.Three%20Steps%20Problem/README.md)                        | `动态规划`                                    | 简单 |
| [08.02](https://leetcode.cn/problems/robot-in-a-grid-lcci)                  | [迷路的机器人](/lcci/08.02.Robot%20in%20a%20Grid/README.md)                      | `动态规划`                                    | 中等 |
| [08.03](https://leetcode.cn/problems/magic-index-lcci)                      | [魔术索引](/lcci/08.03.Magic%20Index/README.md)                                  | `数组`,`二分查找`                             | 简单 |
| [08.04](https://leetcode.cn/problems/power-set-lcci)                        | [幂集](/lcci/08.04.Power%20Set/README.md)                                        | `位运算`,`数组`,`回溯算法`                    | 中等 |
| [08.05](https://leetcode.cn/problems/recursive-mulitply-lcci)               | [递归乘法](/lcci/08.05.Recursive%20Mulitply/README.md)                           | `递归`                                        | 中等 |
| [08.06](https://leetcode.cn/problems/hanota-lcci)                           | [汉诺塔问题](/lcci/08.06.Hanota/README.md)                                       | `递归`                                        | 简单 |
| [08.07](https://leetcode.cn/problems/permutation-i-lcci)                    | [无重复字符串的排列组合](/lcci/08.07.Permutation%20I/README.md)                  | `回溯算法`                                    | 中等 |
| [08.08](https://leetcode.cn/problems/permutation-ii-lcci)                   | [有重复字符串的排列组合](/lcci/08.08.Permutation%20II/README.md)                 | `回溯算法`                                    | 中等 |
| [08.09](https://leetcode.cn/problems/bracket-lcci)                          | [括号](/lcci/08.09.Bracket/README.md)                                            | `字符串`,`回溯算法`                           | 中等 |
| [08.10](https://leetcode.cn/problems/color-fill-lcci)                       | [颜色填充](/lcci/08.10.Color%20Fill/README.md)                                   | `深度优先搜索`                                | 简单 |
| [08.11](https://leetcode.cn/problems/coin-lcci)                             | [硬币](/lcci/08.11.Coin/README.md)                                               | `动态规划`                                    | 中等 |
| [08.12](https://leetcode.cn/problems/eight-queens-lcci)                     | [八皇后](/lcci/08.12.Eight%20Queens/README.md)                                   | `回溯算法`                                    | 困难 |
| [08.13](https://leetcode.cn/problems/pile-box-lcci)                         | [堆箱子](/lcci/08.13.Pile%20Box/README.md)                                       | `动态规划`,`回溯算法`                         | 困难 |
| [08.14](https://leetcode.cn/problems/boolean-evaluation-lcci)               | [布尔运算](/lcci/08.14.Boolean%20Evaluation/README.md)                           | `栈`,`字符串`                                 | 中等 |
| [10.01](https://leetcode.cn/problems/sorted-merge-lcci)                     | [合并排序的数组](/lcci/10.01.Sorted%20Merge/README.md)                           | `数组`,`双指针`                               | 简单 |
| [10.02](https://leetcode.cn/problems/group-anagrams-lcci)                   | [变位词组](/lcci/10.02.Group%20Anagrams/README.md)                               | `哈希表`,`字符串`                             | 中等 |
| [10.03](https://leetcode.cn/problems/search-rotate-array-lcci)              | [搜索旋转数组](/lcci/10.03.Search%20Rotate%20Array/README.md)                    | `数组`,`二分查找`                             | 中等 |
| [10.05](https://leetcode.cn/problems/sparse-array-search-lcci)              | [稀疏数组搜索](/lcci/10.05.Sparse%20Array%20Search/README.md)                    | `二分查找`                                    | 简单 |
| [10.09](https://leetcode.cn/problems/sorted-matrix-search-lcci)             | [排序矩阵查找](/lcci/10.09.Sorted%20Matrix%20Search/README.md)                   | `双指针`,`二分查找`,`分治算法`                | 中等 |
| [10.10](https://leetcode.cn/problems/rank-from-stream-lcci)                 | [数字流的秩](/lcci/10.10.Rank%20from%20Stream/README.md)                         |                                               | 中等 |
| [10.11](https://leetcode.cn/problems/peaks-and-valleys-lcci)                | [峰与谷](/lcci/10.11.Peaks%20and%20Valleys/README.md)                            |                                               | 中等 |
| [16.01](https://leetcode.cn/problems/swap-numbers-lcci)                     | [交换数字](/lcci/16.01.Swap%20Numbers/README.md)                                 | `位运算`,`数学`                               | 中等 |
| [16.02](https://leetcode.cn/problems/words-frequency-lcci)                  | [单词频率](/lcci/16.02.Words%20Frequency/README.md)                              | `设计`,`哈希表`                               | 中等 |
| [16.03](https://leetcode.cn/problems/intersection-lcci)                     | [交点](/lcci/16.03.Intersection/README.md)                                       | `几何`,`数学`                                 | 困难 |
| [16.04](https://leetcode.cn/problems/tic-tac-toe-lcci)                      | [井字游戏](/lcci/16.04.Tic-Tac-Toe/README.md)                                    | `数组`                                        | 中等 |
| [16.05](https://leetcode.cn/problems/factorial-zeros-lcci)                  | [阶乘尾数](/lcci/16.05.Factorial%20Zeros/README.md)                              | `数学`                                        | 简单 |
| [16.06](https://leetcode.cn/problems/smallest-difference-lcci)              | [最小差](/lcci/16.06.Smallest%20Difference/README.md)                            | `数组`,`双指针`                               | 中等 |
| [16.07](https://leetcode.cn/problems/maximum-lcci)                          | [最大数值](/lcci/16.07.Maximum/README.md)                                        | `位运算`,`数学`                               | 简单 |
| [16.08](https://leetcode.cn/problems/english-int-lcci)                      | [整数的英语表示](/lcci/16.08.English%20Int/README.md)                            | `数学`,`字符串`                               | 困难 |
| [16.09](https://leetcode.cn/problems/operations-lcci)                       | [运算](/lcci/16.09.Operations/README.md)                                         | `设计`                                        | 中等 |
| [16.10](https://leetcode.cn/problems/living-people-lcci)                    | [生存人数](/lcci/16.10.Living%20People/README.md)                                | `数组`                                        | 中等 |
| [16.11](https://leetcode.cn/problems/diving-board-lcci)                     | [跳水板](/lcci/16.11.Diving%20Board/README.md)                                   | `递归`,`记忆化`                               | 简单 |
| [16.13](https://leetcode.cn/problems/bisect-squares-lcci)                   | [平分正方形](/lcci/16.13.Bisect%20Squares/README.md)                             | `几何`                                        | 中等 |
| [16.14](https://leetcode.cn/problems/best-line-lcci)                        | [最佳直线](/lcci/16.14.Best%20Line/README.md)                                    | `几何`,`哈希表`                               | 中等 |
| [16.15](https://leetcode.cn/problems/master-mind-lcci)                      | [珠玑妙算](/lcci/16.15.Master%20Mind/README.md)                                  | `数组`                                        | 简单 |
| [16.16](https://leetcode.cn/problems/sub-sort-lcci)                         | [部分排序](/lcci/16.16.Sub%20Sort/README.md)                                     | `排序`,`数组`                                 | 中等 |
| [16.17](https://leetcode.cn/problems/contiguous-sequence-lcci)              | [连续数列](/lcci/16.17.Contiguous%20Sequence/README.md)                          | `数组`,`分治算法`,`动态规划`                  | 简单 |
| [16.18](https://leetcode.cn/problems/pattern-matching-lcci)                 | [模式匹配](/lcci/16.18.Pattern%20Matching/README.md)                             | `字符串`                                      | 中等 |
| [16.19](https://leetcode.cn/problems/pond-sizes-lcci)                       | [水域大小](/lcci/16.19.Pond%20Sizes/README.md)                                   | `深度优先搜索`,`广度优先搜索`                 | 中等 |
| [16.20](https://leetcode.cn/problems/t9-lcci)                               | [T9 键盘](/lcci/16.20.T9/README.md)                                              | `数组`                                        | 中等 |
| [16.21](https://leetcode.cn/problems/sum-swap-lcci)                         | [交换和](/lcci/16.21.Sum%20Swap/README.md)                                       | `排序`,`数组`                                 | 中等 |
| [16.22](https://leetcode.cn/problems/langtons-ant-lcci)                     | [兰顿蚂蚁](/lcci/16.22.Langtons%20Ant/README.md)                                 | `数组`                                        | 中等 |
| [16.24](https://leetcode.cn/problems/pairs-with-sum-lcci)                   | [数对和](/lcci/16.24.Pairs%20With%20Sum/README.md)                               | `数组`,`哈希表`                               | 中等 |
| [16.25](https://leetcode.cn/problems/lru-cache-lcci)                        | [LRU 缓存](/lcci/16.25.LRU%20Cache/README.md)                                    | `设计`                                        | 中等 |
| [16.26](https://leetcode.cn/problems/calculator-lcci)                       | [计算器](/lcci/16.26.Calculator/README.md)                                       | `字符串`                                      | 中等 |
| [17.01](https://leetcode.cn/problems/add-without-plus-lcci)                 | [不用加号的加法](/lcci/17.01.Add%20Without%20Plus/README.md)                     | `位运算`                                      | 简单 |
| [17.04](https://leetcode.cn/problems/missing-number-lcci)                   | [消失的数字](/lcci/17.04.Missing%20Number/README.md)                             | `位运算`,`数组`,`数学`                        | 简单 |
| [17.05](https://leetcode.cn/problems/find-longest-subarray-lcci)            | [ 字母与数字](/lcci/17.05.Find%20Longest%20Subarray/README.md)                   | `数组`                                        | 中等 |
| [17.06](https://leetcode.cn/problems/number-of-2s-in-range-lcci)            | [2 出现的次数](/lcci/17.06.Number%20Of%202s%20In%20Range/README.md)              | `数学`,`动态规划`                             | 中等 |
| [17.07](https://leetcode.cn/problems/baby-names-lcci)                       | [婴儿名字](/lcci/17.07.Baby%20Names/README.md)                                   | `深度优先搜索`,`广度优先搜索`,`并查集`        | 中等 |
| [17.08](https://leetcode.cn/problems/circus-tower-lcci)                     | [马戏团人塔](/lcci/17.08.Circus%20Tower/README.md)                               | `排序`,`二分查找`,`动态规划`                  | 中等 |
| [17.09](https://leetcode.cn/problems/get-kth-magic-number-lcci)             | [第 k 个数](/lcci/17.09.Get%20Kth%20Magic%20Number/README.md)                    | `堆`,`队列`,`数学`                            | 中等 |
| [17.10](https://leetcode.cn/problems/find-majority-element-lcci)            | [主要元素](/lcci/17.10.Find%20Majority%20Element/README.md)                      | `位运算`,`数组`,`分治算法`                    | 简单 |
| [17.11](https://leetcode.cn/problems/find-closest-lcci)                     | [单词距离](/lcci/17.11.Find%20Closest/README.md)                                 | `双指针`,`字符串`                             | 中等 |
| [17.12](https://leetcode.cn/problems/binode-lcci)                           | [BiNode](/lcci/17.12.BiNode/README.md)                                           | `树`,`二叉搜索树`,`递归`                      | 简单 |
| [17.13](https://leetcode.cn/problems/re-space-lcci)                         | [恢复空格](/lcci/17.13.Re-Space/README.md)                                       | `记忆化`,`字符串`                             | 中等 |
| [17.14](https://leetcode.cn/problems/smallest-k-lcci)                       | [最小 K 个数](/lcci/17.14.Smallest%20K/README.md)                                | `堆`,`排序`,`分治算法`                        | 中等 |
| [17.15](https://leetcode.cn/problems/longest-word-lcci)                     | [最长单词](/lcci/17.15.Longest%20Word/README.md)                                 | `字符串`                                      | 中等 |
| [17.16](https://leetcode.cn/problems/the-masseuse-lcci)                     | [按摩师](/lcci/17.16.The%20Masseuse/README.md)                                   | `动态规划`                                    | 简单 |
| [17.17](https://leetcode.cn/problems/multi-search-lcci)                     | [多次搜索](/lcci/17.17.Multi%20Search/README.md)                                 | `字典树`,`字符串`                             | 中等 |
| [17.18](https://leetcode.cn/problems/shortest-supersequence-lcci)           | [最短超串](/lcci/17.18.Shortest%20Supersequence/README.md)                       | `None`                                        | 中等 |
| [17.19](https://leetcode.cn/problems/missing-two-lcci)                      | [消失的两个数字](/lcci/17.19.Missing%20Two/README.md)                            | `数组`,`数学`                                 | 困难 |
| [17.20](https://leetcode.cn/problems/continuous-median-lcci)                | [连续中值](/lcci/17.20.Continuous%20Median/README.md)                            | `堆`                                          | 困难 |
| [17.21](https://leetcode.cn/problems/volume-of-histogram-lcci)              | [直方图的水量](/lcci/17.21.Volume%20of%20Histogram/README.md)                    | `栈`,`数组`,`双指针`                          | 困难 |
| [17.22](https://leetcode.cn/problems/word-transformer-lcci)                 | [单词转换](/lcci/17.22.Word%20Transformer/README.md)                             | `深度优先搜索`,`广度优先搜索`,`数组`,`字符串` | 中等 |
| [17.23](https://leetcode.cn/problems/max-black-square-lcci)                 | [最大黑方阵](/lcci/17.23.Max%20Black%20Square/README.md)                         | `动态规划`                                    | 中等 |
| [17.24](https://leetcode.cn/problems/max-submatrix-lcci)                    | [最大子矩阵](/lcci/17.24.Max%20Submatrix/README.md)                              | `动态规划`                                    | 困难 |
| [17.25](https://leetcode.cn/problems/word-rectangle-lcci)                   | [单词矩阵](/lcci/17.25.Word%20Rectangle/README.md)                               |                                               | 困难 |
| [17.26](https://leetcode.cn/problems/sparse-similarity-lcci)                | [稀疏相似度](/lcci/17.26.Sparse%20Similarity/README.md)                          | `哈希表`                                      | 困难 |

## 版权

本项目著作权归 [GitHub 开源社区 Doocs](https://github.com/doocs) 所有,商业转载请联系 @yanglbme 获得授权,非商业转载请注明出处。

## 联系我们

欢迎各位小伙伴们添加 @yanglbme 的个人微信(微信号:YLB0109),备注 「**leetcode**」。后续我们会创建算法、技术相关的交流群,大家一起交流学习,分享经验,共同进步。

| <img src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/images/qrcode-for-yanglbme.png" width="260px" align="left"/> |
| ------------------------------------------------------------------------------------------------------------------------------ |

## 许可证

<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">知识共享 版权归属-相同方式共享 4.0 国际 公共许可证</a>