{"id":19262894,"url":"https://github.com/datawhalechina/leetcode-notes","last_synced_at":"2025-05-15T02:09:00.519Z","repository":{"id":103512353,"uuid":"519730428","full_name":"datawhalechina/leetcode-notes","owner":"datawhalechina","description":"🐳 LeetCode 算法笔记：面试、刷题、学算法。在线阅读地址：https://datawhalechina.github.io/leetcode-notes/","archived":false,"fork":false,"pushed_at":"2025-01-16T01:03:13.000Z","size":11125,"stargazers_count":825,"open_issues_count":3,"forks_count":136,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-14T01:51:24.564Z","etag":null,"topics":["algorithms","data-structures","interviews","leetcode","python","python3"],"latest_commit_sha":null,"homepage":"https://datawhalechina.github.io/leetcode-notes/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datawhalechina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-31T09:22:15.000Z","updated_at":"2025-04-11T13:49:38.000Z","dependencies_parsed_at":"2023-03-06T00:00:23.500Z","dependency_job_id":"233e6368-a083-4dee-9951-68218a83ca50","html_url":"https://github.com/datawhalechina/leetcode-notes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datawhalechina%2Fleetcode-notes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datawhalechina%2Fleetcode-notes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datawhalechina%2Fleetcode-notes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datawhalechina%2Fleetcode-notes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datawhalechina","download_url":"https://codeload.github.com/datawhalechina/leetcode-notes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259384,"owners_count":22040820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","data-structures","interviews","leetcode","python","python3"],"created_at":"2024-11-09T19:34:02.180Z","updated_at":"2025-05-15T02:09:00.433Z","avatar_url":"https://github.com/datawhalechina.png","language":null,"readme":"# LeetCode 算法笔记（LeetCode-Notes）\n\n## 1. 开源初衷\n\n在互联网行业相关的技术面试中，算法和数据结构知识往往是重点考察的内容。众多知名互联网公司喜欢在面试中考察 LeetCode 上的算法题目，通常需要面试者对给定问题进行深入分析并提供解题思路。有时候，面试官还会要求面试者评估相关算法的时间复杂度和空间复杂度。面试官通过检验面试者对常用算法的熟悉程度和实现能力的方式，从而评估面试者解决实际问题的思维能力水平。因此，对于广大面试者而言，无论是面试国内还是国外的知名互联网公司，通过刷 LeetCode 题目，深入理解算法知识，对拿到一个理想公司的优秀 Offer 都是有帮助的。\n\n为了帮助大家，尤其是零基础或者希望全面学习算法与数据结构基础知识的同学，我们开源了 **「LeetCode 算法笔记」** 教程。该教程以基础的数据结构和算法为起点，系统讲解相关概念和知识点，再针对不同分类的数据结构和算法，从 LeetCode 平台精选出 200 多道经典算法与数据结构题目，进行具体题目的讲解分析。让学习者可以通过「算法基础理论学习」和「编程实战学习」相结合的方式，彻底掌握算法知识。\n\n## 2. 项目简介\n\n- 超详细的「算法与数据结构」基础讲解教程，「LeetCode 200+ 道」经典题目的详细解析。\n- 本项目易于理解，没有大跨度的思维跳跃，项目中使用大量图示、例子来帮助理解。\n- 本项目先从基础的数据结构和算法开始讲解，再针对不同分类的数据结构和算法，进行具体题目的讲解分析。让学习者可以通过「算法基础理论学习」和「编程实战学习」相结合的方式，彻底的掌握算法知识。\n- 本项目从各大知名互联网公司面试算法题中整理汇总了「100 道高频面试题」，帮助面试者更有针对性的准备面试。\n\n## 3. 项目地址\n\n- 开源地址：[https://github.com/datawhalechina/leetcode-notes](https://github.com/datawhalechina/leetcode-notes)\n\n- 在线阅读：[https://datawhalechina.github.io/leetcode-notes/](https://datawhalechina.github.io/leetcode-notes/)\n\n- 下载 PDF：[https://github.com/datawhalechina/leetcode-notes/releases](https://github.com/datawhalechina/leetcode-notes/releases)\n\n## 4. 使用说明\n\n### 4.1 章节划分\n\n1. 项目总共 8 个章节，其中第 01 ~ 05 章节为「算法与数据结构知识」，第 06 ~ 07 章节为「100 道高频面试题汇总」，第 08 章节为「所有习题解析」。\n2. 项目中 的第 01 ~ 07 章节，每一章节对应「一个学习周期 / 一期组队学习安排」，对应学习时间为 14 ~ 16 天，每个学习周期 / 每期组队学习对应 42 ~ 50 道经典 LeetCode 题目。\n3. 章节中每一小节对应「一个学习专题 / 一次打卡任务」，对应时间为 1 ~ 5 天。\n4. 小节中每天都有对应的「学习内容」和「练习题目（每天 3 道）」。\n5. 每天平均花费时间 1 ~ 3 小时不等，根据个人学习接受能力强弱有所浮动。\n\n### 4.2 学习建议\n\n1. 推荐先浏览项目主页的项目介绍，然后按顺序阅读 01 ~ 07 章内容。\n2. 从未刷过算法题目的同学，推荐先看下 「01.01.03 LeetCode 入门及攻略（第 01 ~ 02 天）」 相关内容，对应链接为：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/01.01/01.01.03-LeetCode-Guide.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/01.01/01.01.03-LeetCode-Guide.md)。\n3. 零基础或者想综合学习算法基础知识的同学，推荐按照项目中制定的学习周期进行专题学习。建议先学习 01 ~ 05 章节的算法基础知识。然后再学习 06 ~ 07 章节的面试题目。\n4. 近期有面试需求的同学，推荐直接学习「06. 面试篇（上）（共 16 天）」、「07. 面试篇（下）（共 16 天）」这两期相关内容。\n5. 可在看完每日的学习内容之后，选择每日对应的练习题目进行巩固练习。\n6. 做完每日练习题目之后，如有余力，可通过相关专题下的题目清单进行拓展练习。\n\n## 5. 章节目录\n\n![](./docs/images/202403211118806.png)\n\n### 01. 算法入门与数组篇（共 14 天）：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 01.01 数据结构与算法简介、LeetCode 入门及攻略（第 01 ~ 02 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/01.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/01.01/index.md) |\n| 01.02 数组基础（第 03 ~ 04 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/01.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/01.02/index.md) |\n| 01.03 数组排序（第 05 ~ 08 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/01.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/01.03/index.md) |\n| 01.04 数组二分查找（第 09 ~ 11 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/01.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/01.04/index.md) |\n| 01.05 数组双指针、滑动窗口（第 12 ~ 14 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch01/01.05/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch01/01.05/index.md) |\n\n### 02. 基础数据结构篇（上）：链表、堆栈、队列（共 15 天）：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 02.01 链表（第 01 ~ 04 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/02.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/02.01/index.md) |\n| 02.02 堆栈与单调栈（第 05 ~ 07 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/02.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/02.02/index.md) |\n| 02.03 深度优先搜索（第 08 ~ 10 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/02.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/02.03/index.md) |\n| 02.04 队列与优先队列（第 11 ~ 12 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/02.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/02.04/index.md) |\n| 02.05 广度优先搜索（第 13 ~ 14 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/02.05/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/02.05/index.md) |\n| 02.06 拓扑排序（第 15 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch02/02.06/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch02/02.06/index.md) |\n\n### 03. 基础数据结构篇（下）：哈希表、字符串、二叉树、并查集（共 14 天）：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch03/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch03/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 03.01 哈希表（第 01 ~ 02 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch03/03.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch03/03.01/index.md) |\n| 03.02 字符串与字符串匹配（ 第 03 ~ 07 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch03/03.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch03/03.02/index.md) |\n| 03.03 二叉树（第 08 ~ 10 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch03/03.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch03/03.03/index.md) |\n| 03.04 二叉搜索树（第 11 ~ 12 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch03/03.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch03/03.04/index.md) |\n| 03.05 并查集（第 13 ~ 14 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch03/03.05/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch03/03.05/index.md) |\n\n### 04. 基础算法篇：枚举、递归、分治、回溯、贪心、位运算（共 14 天）：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch04/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch04/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 04.01 枚举算法（第 01 ~ 02 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch04/04.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch04/04.01/index.md) |\n| 04.02 递归算法与分治算法（第 03 ~ 06 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch04/04.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch04/04.02/index.md) |\n| 04.03 回溯算法（第 07 ~ 09 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch04/04.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch04/04.03/index.md) |\n| 04.04 贪心算法（第 10 ~ 12 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch04/04.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch04/04.04/index.md) |\n| 04.05 位运算（第 13 ~ 14 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch04/04.05/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch04/04.05/index.md) |\n\n### 05. 动态规划篇（选学）（共 15 天）：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch05/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch05/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 05.01 动态规划基础、记忆化搜索（ 第 01 ~ 02 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch05/05.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch05/05.01/index.md) |\n| 05.02 线性动态规划（第 03 ~ 06 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch05/05.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch05/05.02/index.md) |\n| 05.03 背包问题（第 07 ~ 09 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch05/05.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch05/05.03/index.md) |\n| 05.04 区间 DP 和 树形 DP（第 10 ~ 12 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch05/05.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch05/05.04/index.md) |\n| 05.05  状压 DP、计数 DP 和数位 DP（第 13 ~ 15 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch05/05.05/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch05/05.05/index.md) |\n\n### 06. 面试篇（上）（共 16 天）[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch06/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch06/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 06.01 第 001 ~ 012 题（第 01 ~ 04 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch06/06.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch06/06.01/index.md) |\n| 06.02 第 013 ~ 025 题（第 05 ~ 08 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch06/06.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch06/06.02/index.md) |\n| 06.03 第 026 ~ 037 题（第 09 ~ 12 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch06/06.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch06/06.03/index.md) |\n| 06.04 第 038 ~ 050 题（第 13 ~ 16 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch06/06.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch06/06.04/index.md) |\n\n### 07. 面试篇（下）（共 16 天）：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch07/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch07/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| 07.01 第 051 ~ 062 题（第 01 ~ 04 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch07/07.01/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch07/07.01/index.md) |\n| 07.02 第 063 ~ 074 题（第 05 ~ 08 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch07/07.02/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch07/07.02/index.md) |\n| 07.03 第 075 ~ 087 题（第 09 ~ 12 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch07/07.03/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch07/07.03/index.md) |\n| 07.04 第 088 ~ 100 题（第 13 ~ 16 天） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/ch07/07.04/index)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/ch07/07.04/index.md) |\n\n### 08. 所有习题解析：[网页链接](https://datawhalechina.github.io/leetcode-notes/#/keys/index.md)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/keys/index.md)\n\n| 章节标题                               | 链接地址                                                     |\n| -------------------------------------- | ------------------------------------------------------------ |\n| LeetCode 题解（字典序排序） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/keys/Solutions-List)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/keys/Solutions-List.md) |\n| LeetCode 题解（按分类排序） | [网页链接](https://datawhalechina.github.io/leetcode-notes/#/keys/Categories-List)、[Github 链接](https://github.com/datawhalechina/leetcode-notes/blob/main/docs/keys/Categories-List.md) |\n\n## 致谢\n\n### 贡献者名单\n\n| 姓名                                  | 职责                          | 简介                        | 联系          |\n| :------------------------------------ | :---------------------------- | :-------------------------- | ------------- |\n| [杨世超](https://github.com/itcharge) | 项目负责人，第 01~07 章节内容 | https://github.com/itcharge | i@itcharge.cn |\n\n### 其他\n\n1. 特别感谢 [@LSGOMYP](https://github.com/LSGOMYP)、[@Sm1les](https://github.com/Sm1les) 对本项目的帮助与支持。\n\n## 关注我们\n\n\u003cdiv align=center\u003e\n\u003cp\u003e扫描下方二维码关注公众号：Datawhale\u003c/p\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/datawhalechina/pumpkin-book/master/res/qrcode.jpeg\" width = \"180\" height = \"180\"\u003e\n\u003c/div\u003e\n\n## LICENSE\n\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/\"\u003e\u003cimg alt=\"知识共享许可协议\" style=\"border-width:0\" src=\"https://img.shields.io/badge/license-CC%20BY--NC--SA%204.0-lightgrey\" /\u003e\u003c/a\u003e\u003cbr/\u003e本作品采用 \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/\"\u003e知识共享署名 - 非商业性使用 - 相同方式共享 4.0 国际许可协议\u003c/a\u003e 进行许可。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatawhalechina%2Fleetcode-notes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatawhalechina%2Fleetcode-notes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatawhalechina%2Fleetcode-notes/lists"}