# LeetCode **Repository Path**: mirrors_Jack-Cherish/LeetCode ## Basic Information - **Project Name**: LeetCode - **Description**: :monkey:LeetCode、剑指Offer刷题笔记(C/C++、Python3实现) - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-01-07 - **Last Updated**: 2025-12-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LeetCode 原创文章每周最少两篇,**后续最新文章**会在[【公众号】](https://cuijiahua.com/wp-content/uploads/2020/05/gzh-w.jpg)首发,视频[【B站】](https://space.bilibili.com/331507846)首发,大家可以加我[【微信】](https://cuijiahua.com/wp-content/uploads/2020/05/gzh-w.jpg)进**交流群**,技术交流或提意见都可以,欢迎**Star**!
## 帮助文档 帮助文档存放在Help文件夹下。 | 文件名 | 文件描述 | 链接 | | :---------: | :----------: | :------------------------------: | |complexitypython.txt|Python的一些常规操作的复杂度统计|[URL](https://github.com/Jack-Cherish/LeetCode/blob/master/Help/complexitypython.txt "悬停显示")| ## 题目清单 题目清单根据题目类型、难度进行排序,符号`*`代表与上下表格合并。 ### Array(数组) | ID | Difficulty | Title | Python | C++ | Blog | | ---- | :--------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | 1 | Easy | Two Sum | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Array/Easy/1.Two%20Sum.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/Array/Easy/1.Two%20Sum.md "悬停显示") | | 11 | Medium | Container With Most Water | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Array/Medium/11.Container%20With%20Most%20Water.md "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Array/Medium/11.Container%20With%20Most%20Water.md "悬停显示") | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/Array/Medium/11.Container%20With%20Most%20Water.md "悬停显示") | ### Linked List(链表) | ID | Difficulty | Title | Python | C++ | Blog | | ---- | :--------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | 21 | Easy | Merge Two Sorted Lists | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/21.Merge%20Two%20Sorted%20Lists/Merge%20Two%20Sorted%20Lists.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/21.Merge%20Two%20Sorted%20Lists/Merge%20Two%20Sorted%20Lists.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/65449271 "悬停显示") | | 83 | * | Remove Duplicates from Sorted List | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/83.Remove%20Duplicates%20from%20Sorted%20List/Remove%20Duplicates%20from%20Sorted%20List.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/83.Remove%20Duplicates%20from%20Sorted%20List/Remove%20Duplicates%20from%20Sorted%20List.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/55106317 "悬停显示") | | 141 | * | Linked List Cycle | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/141.Linked%20List%20Cycle/Linked%20List%20Cycle.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/141.Linked%20List%20Cycle/Linked%20List%20Cycle.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/55054315 "悬停显示") | | 160 | * | Intersection of Two Linked Lists | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/160.Intersection%20of%20Two%20Linked%20Lists/Intersection%20of%20Two%20Linked%20Lists.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/160.Intersection%20of%20Two%20Linked%20Lists/Intersection%20of%20Two%20Linked%20Lists.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/56036016 "悬停显示") | | 203 | * | Remove Linked List Elements | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/203.Remove%20Linked%20List%20Elements/Remove%20Linked%20List%20Elements.cpp "悬停显示") | no | | 206 | * | Reverse Linked List | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/206.Reverse%20Linked%20List/Reverse%20Linked%20List.py "悬停显示") | [C-迭代](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/206.Reverse%20Linked%20List/Reverse%20Linked%20List-iteratively.c "悬停显示") [C-递归](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/206.Reverse%20Linked%20List/Reverse%20Linked%20List-recursively.c "悬停显示")| [博客思路讲解](http://blog.csdn.net/c406495762/article/details/60884576 "悬停显示") | | 234 | * | Palindrome Linked List | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/234.Palindrome%20Linked%20List/Palindrome.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/234.Palindrome%20Linked%20List/Palindrome%20Linked%20List.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/64443419 "悬停显示") | | 237 | Easy | Delete Node in a Linked List | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/237.Delete%20Node%20in%20a%20Linked%20List/Delete%20Node%20in%20a%20Linked%20List.py "悬停显示") | [C](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Easy/237.Delete%20Node%20in%20a%20Linked%20List/Delete%20Node%20in%20a%20Linked%20List.c "悬停显示") | no | | 2 | Medium | Add Two Numbers | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Medium/2.Add%20Two%20Numbers.md "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Medium/2.Add%20Two%20Numbers.md "悬停显示") | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Medium/2.Add%20Two%20Numbers.md "悬停显示") | | 61 | Medium | Rotate | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Medium/61.Rotate%20List/Rotate%20List.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Linked%20List/Medium/61.Rotate%20List/Rotate%20List.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/65626314 "悬停显示") | ### Stack(栈) | ID | Difficulty | Title | Python | C++ | Blog | | ---- | :--------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | 20 | Easy | Valid Parentheses | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Stack/Easy/20.Valid%20Parentheses/Valid%20Parentheses.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/70154279 "悬停显示") | | 155 | * | Min Stack | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Stack/Easy/155.Min%20Stack/Min%20Stack.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/69372722 "悬停显示") | | 255 | * | Implement Stack using Queues | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Stack/Easy/225.Implement%20Stack%20using%20Queues/Implement%20Stack%20using%20Queues.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/67656851 "悬停显示") | | 232 | * | Implement Queue using Stacks | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Stack/Easy/232.Implement%20Queue%20using%20Stacks/Implement%20Queue%20using%20Stacks.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/70149075 "悬停显示") | | 496 | Easy | Next Greater Element I | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Stack/Easy/496.Next%20Greater%20Element%20I/Next%20Greater%20Element%20I.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/69359406 "悬停显示") | | 150 | Medium | Evaluate Reverse Polish Notation | no | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Stack/Medium/150.Evaluate%20Reverse%20Polish%20Notation/Evaluate%20Reverse%20Polish%20Notation.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/70233695 "悬停显示") | ### String(字符串) | ID | Difficulty | Title | Python | C++ | Blog | | ---- | :--------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | 13 | Easy | Roman to Integer | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/13.Roman%20to%20Integer/Roman%20to%20Integer.py "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/tree/master/String/Easy/13.Roman%20to%20Integer "悬停显示") | | 14 | * | Longest Common Prefix | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/14.Longest%20Common%20Prefix/Longest%20Common%20Prefix.py "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/tree/master/String/Easy/14.Longest%20Common%20Prefix "悬停显示") | | 28 | * | Implement strStr | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/28.Implement%20strStr.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/28.Implement%20strStr.md "悬停显示") | | 38 | * | Count and Say | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/38.Count%20and%20Say/Count%20and%20Say.py "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/tree/master/String/Easy/38.Count%20and%20Say "悬停显示") | | 125 | * | Valid Palindrome | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/125.Valid%20Palindrome.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/125.Valid%20Palindrome.md "悬停显示") | | 150 | * | Add Binary | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/67.Add%20Binary/Add%20Binary.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/67.Add%20Binary/67.Add%20Binary.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/72519117 "悬停显示") | | 344 | * | Reverse String | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/344.Reverse%20String/Reverse%20String.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/344.Reverse%20String/Reverse%20String.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/70833096 "悬停显示") | | 345 | * | Reverse Vowels of a String | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/345.Reverse%20Vowels%20of%20a%20String.md "悬停显示") | no | [博客思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/345.Reverse%20Vowels%20of%20a%20String.md "悬停显示") | | 383 | * | Ransom Note | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/383.Ransom%20Note.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/383.Ransom%20Note.md "悬停显示") | | 434 | * | Number of Segments in a String | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/434.Number%20of%20Segments%20in%20a%20String/Number%20of%20Segments%20in%20a%20String.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/434.Number%20of%20Segments%20in%20a%20String/Number%20of%20Segments%20in%20a%20String.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/71786453 "悬停显示") | | 520 | * | Detect Capital | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/520.Detect%20Capital/Detect%20Capital.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/520.Detect%20Capital/Detect%20Capital.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/73495803 "悬停显示") | | 521 | * | Longest Uncommon Subsequence I | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/521.Longest%20Uncommon%20Subsequence%20I/Longest%20Uncommon%20Subsequence%20I.py "悬停显示") | no | no | | 541 | * | Reverse String II | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/541.Reverse%20String%20II/Reverse%20String%20II.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/541.Reverse%20String%20II/Reverse%20String%20II.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/70884683 "悬停显示") | | 551 | * | Student Attendance Record I | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/551.%20Student%20Attendance%20Record%20I/Student%20Attendance%20Record%20I.py "悬停显示") | no | no | | 557 | * | Reverse Words in a String III | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/557.Reverse%20Words%20in%20a%20String%20III/Reverse%20Words%20in%20a%20String%20III.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/557.Reverse%20Words%20in%20a%20String%20III/Reverse%20Words%20in%20a%20String%20III.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/73457057 "悬停显示") | | 657 | Easy | Judge Route Circle | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Easy/657.Judge%20Route%20Circle/Judge%20Route%20Circle.py "悬停显示") | no | no | | 3 | Medium | Longest Substring Without Repeating Characters | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/3.Longest%20Substring%20Without%20Repeating%20Characters.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/3.Longest%20Substring%20Without%20Repeating%20Characters.md "悬停显示") | | 5 | * | Longest Palindromic Substring | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/5.Longest%20Palindromic%20Substring.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/5.Longest%20Palindromic%20Substring.md "悬停显示") | | 17 | * | Letter Combinations of a Phone Number | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/17.Letter%20Combinations%20of%20a%20Phone%20Number.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/17.Letter%20Combinations%20of%20a%20Phone%20Number.md "悬停显示") | | 22 | * | Generate Parentheses | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/22.Generate%20Parentheses.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/22.Generate%20Parentheses.md "悬停显示") | | 43 | * | Multiply Strings | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/43.Multiply%20Strings.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/43.Multiply%20Strings.md "悬停显示") | | 609 | Medium | Find Duplicate File in System | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/609.Find%20Duplicate%20File%20in%20System.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/String/Medium/609.Find%20Duplicate%20File%20in%20System.md "悬停显示") | ### Tree(树) | ID | Difficulty | Title | Python | C++ | Blog | | ---- | :--------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | 111 | Easy | Minimum Depth of Binary Tree | [Py-1](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/111.Minimum%20Depth%20of%20Binary%20Tree/Minimum%20Depth%20of%20Binary%20Tree-1.py "悬停显示") [Py-2](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/111.Minimum%20Depth%20of%20Binary%20Tree/Minimum%20Depth%20of%20Binary%20Tree-2.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/111.Minimum%20Depth%20of%20Binary%20Tree/Minimum%20Depth%20of%20Binary%20Tree.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/75043140 "悬停显示") | | 112 | * | Path Sum | [Py-1](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/112.Path%20Sum/Path%20Sum-1.py "悬停显示") [Py-2](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/112.Path%20Sum/Path%20Sum-2.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/112.Path%20Sum/Path%20Sum.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/76172233 "悬停显示") | | 235 | * | Lowest Common Ancestor of a Binary Search Tree | [Py-1](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/235.Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree-1.py "悬停显示") [Py-2](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/235.Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree-2.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/235.Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/75497795 "悬停显示") | | 501 | * | Find Mode in Binary Search Tree | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/501.Find%20Mode%20in%20Binary%20Search%20Tree/Find%20Mode%20in%20Binary%20Search%20Tree.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/501.Find%20Mode%20in%20Binary%20Search%20Tree/Find%20Mode%20in%20Binary%20Search%20Tree.cpp "悬停显示") | [博客思路讲解](http://blog.csdn.net/c406495762/article/details/76046469 "悬停显示") | | 543 | * | Diameter of Binary Tree | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/543.Diameter%20of%20Binary%20Tree/Diameter%20of%20Binary%20Tree.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/543.Diameter%20of%20Binary%20Tree/Diameter%20of%20Binary%20Tree.cpp "悬停显示") | no | | 606 | Easy | Construct String from Binary Tree | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/606.Construct%20String%20from%20Binary%20Tree/Construct%20String%20from%20Binary%20Tree.py "悬停显示") | [C++](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Easy/606.Construct%20String%20from%20Binary%20Tree/Construct%20String%20from%20Binary%20Tree.cpp "悬停显示") | no | | 113 | Medium | Path Sum II | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Tree/Medium/113.Path%20Sum%20II/Path%20Sum%20II.py "悬停显示") | no | no | ### Hash Table(哈希表) | ID | Difficulty | Title | Python | C++ | Blog | | ---- | :--------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | :--------------------------------------: | | 290 | Easy | Word Pattern.mde | [Python](https://github.com/Jack-Cherish/LeetCode/blob/master/Hash%20Table/Easy/290.Word%20Pattern.md "悬停显示") | no | [思路讲解](https://github.com/Jack-Cherish/LeetCode/blob/master/Hash%20Table/Easy/290.Word%20Pattern.md "悬停显示") | # 剑指Offer(已完成) * [个人网站](http://cuijiahua.com/ "悬停显示")