7-9 目录树 (30分)_LeetCode By Python: 剑指Offer第2版 解题目录

本文提供了一份详细的LeetCode Python系列《剑指Offer(第2版)》解题目录,涵盖了顺序目录、数据结构目录、算法目录和真题目录。目录中包括了各种数据结构(如数组、字符串、链表、树等)和算法(如查找、排序、递归、回溯等),并列举了相关的LeetCode题目,便于读者按主题学习和刷题,提升编程技能和面试准备。
摘要由CSDN通过智能技术生成

1. 介绍

《剑指Offer(第2版)》被许多人称为非常好的练习数据结构、算法、刷题的宝典。

本目录提供 LeetCode By Python 系列中 《剑指Offer(第2版)》的解题分析目录,方便快速查找。

LeetCode《剑指Offer(第2版)》刷题网站

2. 目录

2.1 目录分类

顺序目录:与《剑指Offer(第2版)》和 LeetCode 上顺序一致,方便领会书中知识。

数据结构目录:通过对书中题目涉及的数据结构归类形成的目录,方便数据结构专项训练。

算法目录:通过对书中题目涉及的算法及思路归类形成的目录,方便算法专项训练。

真题目录:根据网上大厂的面试真题和书中题目的重合分类,方便面试突击。

*标题解读:LeetCode By Python: X 剑指Offer第2版 Y 题目名称,其中 X 指 LeetCode 主站的题目编号,Y 指剑指Offer第2版中的题目编号。

2.2 目录总览

1. 介绍
2. 目录
3 顺序目录
4 数据结构目录
5 算法目录
6 真题目录
参考与致谢

3. 顺序目录

3.1 数据结构

  • 数组 1:LeetCode By Python: 剑指Offer第2版 3. 数组中重复的数字
  • 数组 2:LeetCode By Python: 240. 剑指Offer第2版 4. 二维数组中的查找
  • 字符串:LeetCode By Python: 剑指Offer第2版 5. 替换空格
  • 链表:LeetCode By Python: 剑指Offer第2版 6. 从尾到头打印链表
  • 树:LeetCode By Python: 105. 剑指Offer第2版 7. 重建二叉树
  • 栈和队列:LeetCode By Python: 剑指Offer第2版 9. 用两个栈实现队列

3.2 算法和数据操作

  • 递归和循环:LeetCode By Python: 509. 70. 剑指Offer第2版 10. 斐波那契数列
  • 查找和排序:LeetCode By Python: 154. 剑指Offer第2版 11. 旋转数组的最小数字
  • 回溯法1 :LeetCode By Python: 79. 剑指Offer第2版 12. 矩阵中的路径
  • 回溯法2 :LeetCode By Python: 剑指Offer第2版 13. 机器人的运动范围
  • 动态规划与贪婪算法:LeetCode By Python: 343. 剑指Offer第2版 14.1 & 2. 剪绳子
  • 位运算:LeetCode By Python: 191. 剑指Offer第2版 15. 二进制中1的个数

3.3 代码的完整性

  • LeetCode By Python: 50. 剑指Offer第2版 16. 数值的整数次方
  • LeetCode By Python: 剑指Offer第2版 17. 打印从1到最大的n位数
  • LeetCode By Python: 剑指Offer第2版 18. 删除链表的节点
  • LeetCode By Python: 10. 剑指Offer第2版 19. 正则表达式匹配
  • LeetCode By Python: 65. 剑指Offer第2版 20. 有效数字
  • LeetCode By Python: 剑指Offer第2版 21. 调整数组顺序使奇数位于偶数前面

3.4 代码的鲁棒性

  • LeetCode By Python: 剑指Offer第2版 22. 链表中倒数第k个字节
  • LeetCode By Python: 206. 剑指Offer第2版 24. 反转链表
  • LeetCode By Python: 21. 剑指Offer第2版25. 合并两个排序的链表
  • LeetCode By Python: 剑指Offer第2版 26. 树的子结构

3.5 画图让抽象问题具体化

  • LeetCode By Python: 226. 剑指Offer第2版 27. 二叉树的镜像
  • LeetCode By Python: 101. 剑指Offer第2版 28. 对称的二叉树
  • LeetCode By Python: 54. 剑指Offer第2版29. 顺时针打印矩阵

3.6 举例让抽象问题具体化

  • LeetCode By Python: 155. 剑指Offer第2版 30. 包含min函数的栈
  • LeetCode By Python: 946. 剑指Offer第2版 31. 栈的压入、弹出序列
  • LeetCode By Python: 剑指Offer第2版 32-1. 从上到下打印二叉树 1
  • LeetCode By Python: 102. 剑指Offer第2版 32-2. 从上到下打二叉树
  • LeetCode By Python: 剑指Offer第2版 32-3. 从上到下打印二叉树 3
  • LeetCode By Python: 剑指Offer第2版33. 二叉搜索树的后序遍历序列
  • LeetCode By Python: 113. 剑指Offer第2版 34. 二叉树中和为某值路径

3.7 分解让复杂问题简单化

  • LeetCode By Python: 138. 剑指Offer第2版 35. 复杂链表的复制
  • LeetCode By Python: 426. 剑指Offer第2版36. 二叉搜索树与双向链表
  • LeetCode By Python: 279. 剑指Offer第2版 37. 序列化二叉树
  • LeetCode By Python: 剑指Offer第2版 38. 字符串的排列

3.8 优化时间效率

  • LeetCode By Python: 169. 剑指Offer第2版 39. 多数元素
  • LeetCode By Python: 剑指Offer第2版 40. 最小的k个数
  • LeetCode By Python: 295. 剑指Offer第2版 41. 数据流中的中位数
  • LeetCode By Python: 53. 剑指Offer第2版 42. 连续子数组的最大和
  • LeetCode By Python: 233. 剑指Offer第2版 43. 1出现的次数
  • LeetCode By Python: 400. 剑指Offer第2版 44. 第N个数字
  • LeetCode By Python: 剑指Offer第2版 45. 把数组排成最小的数
  • LeetCode By Python: 剑指Offer 46. 把数字翻译成字符串
  • LeetCode By Python: 剑指Offer 47. 礼物的最大价值
  • LeetCode By Python: 3. 剑指Offer第2版 48. 最长不重复的子字符串

3.9 时间效率与空间效率的平衡

  • LeetCode By Python: 264. 剑指Offer第2版 49. 丑数
  • LeetCode By Python: 剑指Offer第2版 50. 第一个只出现一次的字符
  • LeetCode By Python: 剑指Offer第2版 51. 数组中的逆序对
  • LeetCode By Python: 剑指Offer第2版 52. 两个链表的第一个公共节点

3.10 知识迁移能力

  • LeetCode By Python: 34. 剑指Offer第2版 53-1. 两链表的公共节点
  • LeetCode By Python: 剑指Offer第2版 53-2. 0~n-1中缺失的数
  • LeetCode By Python: 剑指Offer第2版 54. 二叉搜索树的第k大节点
  • LeetCode By Python: 104. 剑指Offer第2版 55-1. 二叉树的深度
  • LeetCode By Python: 110. 剑指Offer第2版 55-2. 平衡二叉树
  • LeetCode By Python: 260. 剑指Offer第2版 56-1. 数出现次数
  • LeetCode By Python: 137. 剑指Offer第2版 56-2. 数出现次数
  • LeetCode By Python: 剑指Offer第2版 57-1. 和为s的两个数字
  • LeetCode By Python: 剑指Offer第2版 57-2. 和为s的连续正数序列
  • LeetCode By Python: 151. 剑指Offer第2版 58-1. 翻转单词顺序
  • LeetCode By Python: 剑指Offer第2版 58-2. 左旋转字符串
  • LeetCode By Python: 239. 剑指Offer第2版 59-1. 滑动窗口的最大值
  • LeetCode By Python: 剑指Offer第2版 59-2. 队列的最大值

3.11 抽象建模能力

  • LeetCode By Python: 剑指Offer第2版 60. n个骰子的点数
  • LeetCode By Python: 剑指Offer第2版 61. 队列的最大值
  • LeetCode By Python: 剑指Offer第2版 62. 圆圈中最后剩下的数字
  • LeetCode By Python: 剑指Offer第2版 63. 股票的最大利润

3.12 发散思维能力

  • LeetCode By Python: 剑指Offer第2版 64. 求1+2+…+n
  • LeetCode By Python: 剑指Offer第2版 65. 不用加减乘除做加法
  • LeetCode By Python: 剑指Offer第2版 66. 构建乘积数组

3.13 面试案例

  • LeetCode By Python: 剑指Offer第2版 67. 把字符串转换成整数
  • LeetCode By Python: 235. 剑指Offer第2版68-1. 二叉搜索树最近公共祖先
  • LeetCode By Python 236: 剑指Offer第2版 68-2. 二叉树最近公共祖先

4. 数据结构目录

4.1 数组

  • LeetCode By Python: 剑指Offer第2版 3. 数组中重复的数字
  • LeetCode By Python: 240. 剑指Offer第2版 4. 二维数组中的查找
  • LeetCode By Python: 154. 剑指Offer第2版 11. 旋转数组的最小数字
  • LeetCode By Python: 剑指Offer第2版 21. 调整数组顺序使奇数位于偶数前面
  • LeetCode By Python: 剑指Offer第2版 40. 最小的k个数
  • LeetCode By Python: 295. 剑指Offer第2版 41. 数据流中的中位数
  • LeetCode By Python: 53. 剑指Offer第2版 42. 连续子数组的最大和
  • LeetCode By Python: 剑指Offer第2版 45. 把数组排成最小的数
  • LeetCode By Python: 剑指Offer第2版 51. 数组中的逆序对
  • LeetCode By Python: 剑指Offer第2版 53-2. 0~n-1中缺失的数
  • LeetCode By Python: 260. 剑指Offer第2版 56-1. 数出现次数
  • LeetCode By Python: 剑指Offer第2版 66. 构建乘积数组
  • LeetCode By Python: 54. 剑指Offer第2版29. 顺时针打印矩阵

4.3 字符串

  • LeetCode By Python: 剑指Offer第2版 5. 替换空格
  • LeetCode By Python: 剑指Offer第2版 38. 字符串的排列
  • LeetCode By Python: 剑指Offer 46. 把数字翻译成字符串
  • LeetCode By Python: 3. 剑指Offer第2版 48. 最长不重复的子字符串
  • LeetCode By Python: 剑指Offer第2版 50. 第一个只出现一次的字符
  • LeetCode By Python: 151. 剑指Offer第2版 58-1. 翻转单词顺序
  • LeetCode By Python: 剑指Offer第2版 58-2. 左旋转字符串
  • LeetCode By Python: 剑指Offer第2版 67. 把字符串转换成整数

4.4 链表

  • LeetCode By Python: 剑指Offer第2版 6. 从尾到头打印链表
  • LeetCode By Python: 剑指Offer第2版 18. 删除链表的节点
  • LeetCode By Python: 剑指Offer第2版 22. 链表中倒数第k个字节
  • LeetCode By Python: 206. 剑指Offer第2版 24. 反转链表
  • LeetCode By Python: 21. 剑指Offer第2版25. 合并两个排序的链表
  • LeetCode By Python: 138. 剑指Offer第2版 35. 复杂链表的复制
  • LeetCode By Python: 426. 剑指Offer第2版36. 二叉搜索树与双向链表
  • LeetCode By Python: 剑指Offer第2版 52. 两个链表的第一个公共节点
  • LeetCode By Python: 34. 剑指Offer第2版 53-1. 两链表的公共节点
  • LeetCode By Python: 295. 剑指Offer第2版 41. 数据流中的中位数

4.5 树

  • LeetCode By Python: 105. 剑指Offer第2版 7. 重建二叉树
  • LeetCode By Python: 剑指Offer第2版 26. 树的子结构
  • LeetCode By Python: 226. 剑指Offer第2版 27. 二叉树的镜像
  • LeetCode By Python: 101. 剑指Offer第2版 28. 对称的二叉树
  • LeetCode By Python: 剑指Offer第2版 32-1. 从上到下打印二叉树 1
  • LeetCode By Python: 102. 剑指Offer第2版 32-2. 从上到下打二叉树
  • LeetCode By Python: 剑指Offer第2版 32-3. 从上到下打印二叉树 3
  • LeetCode By Python: 剑指Offer第2版33. 二叉搜索树的后序遍历序列
  • LeetCode By Python: 113. 剑指Offer第2版 34. 二叉树中和为某值路径
  • LeetCode By Python: 426. 剑指Offer第2版36. 二叉搜索树与双向链表
  • LeetCode By Python: 279. 剑指Offer第2版 37. 序列化二叉树
  • LeetCode By Python: 剑指Offer第2版 54. 二叉搜索树的第k大节点
  • LeetCode By Python: 104. 剑指Offer第2版 55-1. 二叉树的深度
  • LeetCode By Python: 110. 剑指Offer第2版 55-2. 平衡二叉树
  • LeetCode By Python: 295. 剑指Offer第2版 41. 数据流中的中位数

*树的很多算法,离不开递归。

4.6 栈、队列、堆

  • LeetCode By Python: 剑指Offer第2版 9. 用两个栈实现队列
  • LeetCode By Python: 剑指Offer第2版 6. 从尾到头打印链表
  • LeetCode By Python: 155. 剑指Offer第2版 30. 包含min函数的栈
  • LeetCode By Python: 946. 剑指Offer第2版 31. 栈的压入、弹出序列
  • LeetCode By Python: 151. 剑指Offer第2版 58-1. 翻转单词顺序
  • LeetCode By Python: 剑指Offer第2版 59-2. 队列的最大值
  • LeetCode By Python: 剑指Offer第2版 61. 队列的最大值
  • LeetCode By Python: 剑指Offer第2版 40. 最小的k个数

4.7 哈希表

  • LeetCode By Python: 剑指Offer第2版 3. 数组中重复的数字
  • LeetCode By Python: 169. 剑指Offer第2版 39. 多数元素
  • LeetCode By Python: 剑指Offer第2版 50. 第一个只出现一次的字符

5 算法目录

5.1 查找、排序算法

  • LeetCode By Python: 240. 剑指Offer第2版 4. 二维数组中的查找
  • LeetCode By Python: 154. 剑指Offer第2版 11. 旋转数组的最小数字
  • LeetCode By Python: 剑指Offer第2版 21. 调整数组顺序使奇数位于偶数前面
  • LeetCode By Python: 54. 剑指Offer第2版29. 顺时针打印矩阵
  • LeetCode By Python: 169. 剑指Offer第2版 39. 多数元素
  • LeetCode By Python: 剑指Offer第2版 40. 最小的k个数
  • LeetCode By Python: 295. 剑指Offer第2版 41. 数据流中的中位数
  • LeetCode By Python: 剑指Offer第2版 51. 数组中的逆序对
  • LeetCode By Python: 260. 剑指Offer第2版 56-1. 数出现次数

5.2 递归

  • LeetCode By Python: 509. 70. 剑指Offer第2版 10. 斐波那契数列
  • LeetCode By Python: 剑指Offer第2版 6. 从尾到头打印链表
  • LeetCode By Python: 105. 剑指Offer第2版 7. 重建二叉树
  • LeetCode By Python: 50. 剑指Offer第2版 16. 数值的整数次方
  • LeetCode By Python: 10. 剑指Offer第2版 19. 正则表达式匹配
  • LeetCode By Python: 21. 剑指Offer第2版25. 合并两个排序的链表
  • LeetCode By Python: 剑指Offer第2版 26. 树的子结构
  • LeetCode By Python: 226. 剑指Offer第2版 27. 二叉树的镜像
  • LeetCode By Python: 101. 剑指Offer第2版 28. 对称的二叉树
  • LeetCode By Python: 剑指Offer第2版 38. 字符串的排列
  • LeetCode By Python: 279. 剑指Offer第2版 37. 序列化二叉树
  • LeetCode By Python: 剑指Offer 46. 把数字翻译成字符串
  • LeetCode By Python: 剑指Offer 47. 礼物的最大价值
  • LeetCode By Python: 34. 剑指Offer第2版 53-1. 两链表的公共节点
  • LeetCode By Python: 104. 剑指Offer第2版 55-1. 二叉树的深度
  • LeetCode By Python: 剑指Offer第2版 64. 求1+2+…+n
  • LeetCode By Python: 235.剑指Offer第2版68-1.二叉搜索树最近公共祖先
  • LeetCode By Python 236: 剑指Offer第2版 68-2. 二叉树最近公共祖先

5.3 回溯法

  • LeetCode By Python: 79. 剑指Offer第2版 12. 矩阵中的路径
  • LeetCode By Python: 剑指Offer第2版 13. 机器人的运动范围
  • LeetCode By Python: 113. 剑指Offer第2版 34. 二叉树中和为某值路径

5.4 动态规划与贪婪算法

  • LeetCode By Python: 343. 剑指Offer第2版 14.1 & 2. 剪绳子
  • LeetCode By Python: 53. 剑指Offer第2版 42. 连续子数组的最大和
  • LeetCode By Python: 剑指Offer 46. 把数字翻译成字符串
  • LeetCode By Python: 剑指Offer 47. 礼物的最大价值
  • LeetCode By Python: 剑指Offer第2版 60. n个骰子的点数
  • LeetCode By Python: 剑指Offer第2版 63. 股票的最大利润
  • LeetCode By Python: 10. 剑指Offer第2版 19. 正则表达式匹配

5.5 深度遍历、广度遍历

  • LeetCode By Python: 110. 剑指Offer第2版 55-2. 平衡二叉树
  • LeetCode By Python: 235.剑指Offer第2版68-1.二叉搜索树最近公共祖先
  • LeetCode By Python: 79. 剑指Offer第2版 12. 矩阵中的路径
  • LeetCode By Python: 剑指Offer第2版 13. 机器人的运动范围

*许多二叉树和二维数组相关

5.6 位运算

  • LeetCode By Python: 191. 剑指Offer第2版 15. 二进制中1的个数
  • LeetCode By Python: 260. 剑指Offer第2版 56-1. 数出现次数
  • LeetCode By Python: 137. 剑指Offer第2版 56-2. 数出现次数
  • LeetCode By Python: 剑指Offer第2版 64. 求1+2+…+n
  • LeetCode By Python: 剑指Offer第2版 65. 不用加减乘除做加法

5.7 分治算法

  • LeetCode By Python: 剑指Offer第2版 38. 字符串的排列
  • LeetCode By Python: 34. 剑指Offer第2版 53-1. 两链表的公共节点
  • LeetCode By Python: 剑指Offer第2版 53-2. 0~n-1中缺失的数

5.8 正则表达式

  • LeetCode By Python: 65. 剑指Offer第2版 20. 有效数字
  • LeetCode By Python: 剑指Offer第2版 67. 把字符串转换成整数

5.9 状态向量机

  • LeetCode By Python: 65. 剑指Offer第2版 20. 有效数字

5.10 双指针

  • LeetCode By Python: 剑指Offer第2版 21. 调整数组顺序使奇数位于偶数前面
  • LeetCode By Python: 剑指Offer第2版 22. 链表中倒数第k个字节
  • LeetCode By Python: 剑指Offer第2版 52. 两个链表的第一个公共节点
  • LeetCode By Python: 剑指Offer第2版 57-1. 和为s的两个数字

5.11 滑动窗口

  • LeetCode By Python: 3. 剑指Offer第2版 48. 最长不重复的子字符串
  • LeetCode By Python: 剑指Offer第2版 57-2. 和为s的连续正数序列
  • LeetCode By Python: 239. 剑指Offer第2版 59-1. 滑动窗口的最大值

5.12 辅助数据结构

  • LeetCode By Python: 155. 剑指Offer第2版 30. 包含min函数的栈
  • LeetCode By Python: 946. 剑指Offer第2版 31. 栈的压入、弹出序列
  • LeetCode By Python: 剑指Offer第2版 32-3. 从上到下打印二叉树 3
  • LeetCode By Python: 剑指Offer第2版33. 二叉搜索树的后序遍历序列
  • LeetCode By Python: 剑指Offer第2版 66. 构建乘积数组

5.13 找规律

  • LeetCode By Python: 53. 剑指Offer第2版 42. 连续子数组的最大和
  • LeetCode By Python: 233. 剑指Offer第2版 43. 1出现的次数
  • LeetCode By Python: 400. 剑指Offer第2版 44. 第N个数字
  • LeetCode By Python: 剑指Offer第2版 45. 把数组排成最小的数
  • LeetCode By Python: 剑指Offer第2版 61. 队列的最大值
  • LeetCode By Python: 剑指Offer第2版 62. 圆圈中最后剩下的数字

6. 真题目录

6.1 阿里巴巴

  • LeetCode By Python: 剑指Offer第2版 54. 二叉搜索树的第k大节点 (题目为第k小)

6.2 百度

  • LeetCode By Python: 21. 剑指Offer第2版25. 合并两个排序的链表

6.3 腾讯

  • LeetCode By Python: 206. 剑指Offer第2版 24. 反转链表
  • LeetCode By Python: 113. 剑指Offer第2版 34. 二叉树中和为某值路径
  • LeetCode By Python: 50. 剑指Offer第2版 16. 数值的整数次方

6.4 字节跳动

  • LeetCode By Python 236: 剑指Offer第2版 68-2. 二叉树最近公共祖先

6.5 京东

  • LeetCode By Python: 509. 70. 剑指Offer第2版 10. 斐波那契数列
  • LeetCode By Python: 剑指Offer第2版 13. 机器人的运动范围

6.6 快手

  • LeetCode By Python: 138. 剑指Offer第2版 35. 复杂链表的复制

参考与致谢

(Acknowledge for any mistakes found. The post will update on a regular basis.)

(部分内容,如未能一一致谢,请联系我,给您补上 )

《剑指Offer(第2版)》

看阿里大佬们是如何刷《剑指 offer》的?

正是因为这道算法题不会做,所以面试凉凉了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值