Skip to content

Commit 84e210d

Browse files
committed
新增STL内容
1 parent 6791806 commit 84e210d

39 files changed

+2296
-640
lines changed

README.md

Lines changed: 24 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,48 @@
11

2-
# leetcode顺序
3-
|  题号  | 题目链接            | 答案链接            |  难度  |  完成度  |
4-
| :--: | :--: | :----------------------------------------------------------- | :----------------------------------------------------------- | :------: |
5-
| 1| [两数之和](https://leetcode-cn.com/problems/two-sum/) | [twoSum](./array/leetcode/easy/twoSum.h) | <font color=green>easy</font> ||
6-
| 2| [两数相加](https://leetcode-cn.com/problems/add-two-numbers/) | [addTwoNumbers](./linkedList/leetcode/medium/addTwoNumbers.h) | <font color=orange> medium </font> ||
7-
| 3| [无重复字符的最长子串](https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/) | [lengthOfLongestSubstring](./string/leetcode/medium/lengthOfLongestSubstring.h) | <font color=orange> medium </font> ||
8-
| 5| [最长回文子串](https://leetcode-cn.com/problems/longest-palindromic-substring/) | [longestPalindrome](./string/leetcode/medium/longestPalindrome.h) | <font color=orange> medium </font>||
9-
| 6| [Z字形变换](https://leetcode-cn.com/problems/zigzag-conversion/) | [zigzag_conversion](./string/leetcode/medium/zigzag_conversion.h) | <font color=orange> medium </font>||
10-
| 7| [整数反转](https://leetcode-cn.com/problems/reverse-integer/) | [reverse_integer](./other/leetcode/easy/reverse_integer.h) | <font color=green>easy</font> ||
11-
| 8| [字符串转换整数 (atoi)](https://leetcode-cn.com/problems/string-to-integer-atoi/) | [string_to_integer_atoi](./string/leetcode/medium/string_to_integer_atoi.h) | <font color=orange> medium </font> ||
12-
| 9| [回文数](https://leetcode-cn.com/problems/palindrome-number/) | [palindrome_number](./other/leetcode/easy/palindrome_number.h) | <font color=green>easy</font> ||
13-
| 11 | [盛最多水的容器](https://leetcode-cn.com/problems/container-with-most-water/) | [maxArea](./array/leetcode/maxArea.h) | <font color=orange> medium </font> ||
14-
| 12 | [整数转罗马数字](https://leetcode-cn.com/problems/integer-to-roman/) | [integer_to_roman](./string/leetcode/medium/integer_to_roman.h) | <font color=orange> medium </font> ||
15-
| 13| [罗马数字转整数](https://leetcode-cn.com/problems/roman-to-integer/) | [romanToInt](./string/leetcode/easy/romanToInt.h) | <font color=green>easy</font> ||
16-
| 14| [最长功能前缀](https://leetcode-cn.com/problems/longest-common-prefix/) | [longestCommonPrefix](./string/leetcode/easy/longestCommonPrefix.h) | <font color=green>easy</font> ||
17-
| 15 | [三数之和](https://leetcode-cn.com/problems/3sum/) | [3sum](./array/leetcode/medium/3sum.h) | <font color=orange> medium </font> ||
18-
| 16 | [最接近的三数之和](https://leetcode-cn.com/problems/3sum-closest) | [3SumClosest](./array/leetcode/medium/3SumClosest.h) | <font color=orange> medium </font> ||
19-
| 17 | [电话号码的字母组合](https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/) | [letter_combinations_of_a_phone_number](./backtracking/leetcode/medium/letter_combinations_of_a_phone_number.h) | <font color=orange> medium </font> ||
20-
| 19 | [ 删除链表的倒数第N个节点](https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list)| [removeNthFromEnd](./linkedList/leetcode/removeNthFromEnd.h) | <font color=orange> medium </font>||
21-
| 20 | [有限的括号](https://leetcode-cn.com/problems/valid-parentheses/)| [isValid](./stack+queue/leetcode/easy/isValid.h) | <font color=green>easy</font> ||
22-
| 21 | [合并两个有序链表](https://leetcode-cn.com/problems/merge-two-sorted-lists)| [mergeTwoLists](./linkedList/leetcode/easy/mergeTwoLists.h) | <font color=green>easy</font> ||
23-
| 22 | [括号生成](https://leetcode-cn.com/problems/generate-parentheses/)| [generateParenthesis](./recursion/leetcode/medium/generateParenthesis.h) | <font color=orange> medium </font> ||
24-
| 24 | [两两交换链表中的节点](https://leetcode-cn.com/problems/swap-nodes-in-pairs)| [swapPairs](./linkedList/leetcode/medium/swapPairs.h) | <font color=orange> medium </font> ||
25-
| 26 | [删除排序数组中重复项](https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/) | [removeDuplicates](./array/leetcode/easy/removeDuplicates.h) | <font color=green>easy</font> ||
26-
| 27 | [移除元素](https://leetcode-cn.com/problems/remove-element/submissions/) | [removeElement](./array/leetcode/easy/removeElement.h) | <font color=green>easy</font> ||
27-
| 28| [实现 strStr()](https://leetcode-cn.com/problems/implement-strstr/) | [strStr](./string/leetcode/easy/strStr.h) | <font color=green>easy</font> ||
28-
| 31| [下一个排列](https://leetcode-cn.com/problems/next-permutation/) | [next_permutation](./other/leetcode/medium/next_permutation.h) | <font color=orange> medium </font>||
29-
| 33 | [搜索旋转排序数组](https://leetcode-cn.com/problems/search-in-rotated-sorted-array)| [searchInRotatedSortedArray](./bsearch/leetcode/medium/searchInRotatedSortedArray.h) | <font color=orange> medium </font> ||
30-
| 34 | [在排序数组中查找元素的第一个和最后一个位置](https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/)| [searchRange](./bsearch/leetcode/medium/searchRange.h) | <font color=orange> medium </font> ||
31-
| 35 | [搜索插入位置](https://leetcode-cn.com/problems/search-insert-position/) | [searchInsert](./array/leetcode/easy/searchInsert.h) | <font color=green>easy</font> ||
32-
| 36 | [有效的数独](https://leetcode-cn.com/problems/valid-sudoku/)| [isValidSudoku](./other/leetcode/medium/isValidSudoku.h) | <font color=orange> medium </font> ||
33-
| 39 | [组合总和](https://leetcode-cn.com/problems/combination-sum/)| [combinationSum](./backtracking/leetcode/medium/combinationSum.h) | <font color=orange> medium </font> ||
34-
| 40 | [组合总和II](https://leetcode-cn.com/problems/combination-sum-ii/)| [combinationSumII](./backtracking/leetcode/medium/combinationSumII.h) | <font color=orange> medium </font> ||
35-
| 46 | [全排列](https://leetcode-cn.com/problems/permutations/)| [permutations](./backtracking/leetcode/medium/permutations.h) | <font color=orange> medium </font> ||
36-
| 47 | [全排列II](https://leetcode-cn.com/problems/permutations-ii/)| [permutationsii](./backtracking/leetcode/medium/permutationsii.h) | <font color=orange> medium </font> ||
37-
| 50 | [Pow(x, n)](https://leetcode-cn.com/problems/powx-n/solution/powx-n-by-leetcode/) | [powx](./bsearch/leetcode/medium/powx.h) | <font color=orange> medium </font> ||
38-
| 53 | [最大子序和](https://leetcode-cn.com/problems/maximum-subarray/) | [maxSubArray](./array/leetcode/easy/maxSubArray.h) | <font color=green>easy</font> ||
39-
| 55 | [跳跃游戏](https://leetcode-cn.com/problems/jump-game/) | [jump_game](./greed/leetcode/medium/jump_game.h) | <font color=orange> medium </font> ||
40-
| 56 | [合并区间](https://leetcode-cn.com/problems/merge-intervals/) | [merge_intervals](./sort/leetcode/merge_intervals.h) | <font color=orange> medium </font> ||
41-
| 58| [最后一个单词的长度](https://leetcode-cn.com/problems/length-of-last-word) | [lengthOfLastWord](./string/leetcode/easy/lengthOfLastWord.h) | <font color=green>easy</font> ||
42-
| 60 | [第k个排列](https://leetcode-cn.com/problems/permutation-sequence/)| [permutation_sequence](./backtracking/leetcode/medium/permutation_sequence.h) | <font color=orange> medium </font> ||
43-
| 66 | [加一](https://leetcode-cn.com/problems/plus-one/) | [plusOne](./array/leetcode/easy/plusOne.h) | <font color=green>easy</font> ||
44-
| 67 | [二进制求和](https://leetcode-cn.com/problems/add-binary/) | [addBinary](./array/leetcode/easy/addBinary.h) | <font color=green>easy</font> ||
45-
| 69 | [x 的平方根](https://leetcode-cn.com/problems/sqrtx/%E2%80%A8)| [mySqrt](./bsearch/leetcode/mySqrt.h) | <font color=green>easy</font> ||
46-
| 70 | [爬楼梯](https://leetcode-cn.com/problems/climbing-stairs/)| [climbStairs](./dp/leetcode/easy/climbStairs.h) | <font color=green>easy</font> ||
47-
| 74 | [搜索二维矩阵](https://leetcode-cn.com/problems/search-a-2d-matrix/) | [search_a_2d_matrix](./bsearch/leetcode/medium/search_a_2d_matrix.h) | <font color=orange> medium </font> ||
48-
| 75 | [颜色分类](https://leetcode-cn.com/problems/sort-colors/) | [sort_colors](./sort/leetcode/sort_colors.h) | <font color=orange> medium </font> ||
49-
| 77 | [组合](https://leetcode-cn.com/problems/combinations/)| [combinations](./backtracking/leetcode/medium/combinations.h) | <font color=orange> medium </font> ||
50-
| 78 | [子集](https://leetcode-cn.com/problems/subsets/)| [subsets](./backtracking/leetcode/medium/subsets.h) | <font color=orange> medium </font> ||
51-
| 79 | [单词搜索](https://leetcode-cn.com/problems/word-search/)| [word_search](./backtracking/leetcode/medium/word_search.h) | <font color=orange> medium </font> ||
52-
| 81 | [搜索旋转排序数组II](https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/) | [searchInRotatedSortedArrayII](./bsearch/leetcode/medium/searchInRotatedSortedArrayII.h) | <font color=orange> medium </font> ||
53-
| 83 | [删除排序链表中的重复元素](https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/)| [deleteDuplicates](./linkedList/leetcode/easy/deleteDuplicates.h) | <font color=green>easy</font> ||
54-
| 88 | [合并两个有序数组](https://leetcode-cn.com/problems/merge-sorted-array/) | [merge](./array/leetcode/easy/merge.h) | <font color=green>easy</font> ||
55-
| 89 | [格雷编码](https://leetcode-cn.com/problems/gray-code/)| [gray_code](./backtracking/leetcode/medium/gray_code.h) | <font color=orange> medium </font> ||
56-
| 90 | [子集II](https://leetcode-cn.com/problems/subsets-ii)| [subsets_ii](./backtracking/leetcode/medium/subsets_ii.h) | <font color=orange> medium </font> ||
57-
| 93 | [复原IP地址](https://leetcode-cn.com/problems/restore-ip-addresses)| [restore_ip_addresses](./backtracking/leetcode/medium/restore_ip_addresses.h) | <font color=orange> medium </font> ||
58-
| 100 | [相同的树](https://leetcode-cn.com/problems/same-tree/) | [isSameTree](./tree/leetcode/easy/isSameTree.h) | <font color=green>easy</font> ||
59-
| 134 | [加油站](https://leetcode-cn.com/problems/gas-station/) | [gas_station](./greed/leetcode/medium/gas_station.h) | <font color=orange> medium </font> ||
60-
| 153 | [寻找旋转排序数组中的最小值](https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/) | [find_minimum_in_rotated_sorted_array](./bsearch/leetcode/medium/find_minimum_in_rotated_sorted_array.h) | <font color=orange> medium </font> ||
61-
| 687 | [最长同值路径](https://leetcode-cn.com/problems/longest-univalue-path/)| [longestUnivaluePath](./recursion/leetcode/medium/longestUnivaluePath.h) | <font color=green>easy</font> ||
62-
63-
64-
65-
66-
67-
----------------
68-
-----------------
69-
------------------------
70-
------------------------
71-
----------------------------------
72-
73-
742

753
下面按照具体的分类来刷题,总结每个思想的精髓。
764

775
# **算法思想**
786

79-
## [递归](./recursion.md)
80-
81-
## [排序](./sort.md)
82-
83-
## [二分查找](./bsearch.md)
7+
- [排序](./sort.md)
8+
- [递归](./recursion.md)
9+
- [二分查找](./bsearch.md)
10+
- [哈希算法](./hash.md)
8411

85-
## [哈希算法](./hash.md)
86-
87-
下面这四大基本算法,贪心,回溯,DP属于一类,这三个算法解决问题的模型都可以定义为“多阶段最优解问题”。
12+
<!--下面这四大基本算法,贪心,回溯,DP属于一类,这三个算法解决问题的模型都可以定义为“多阶段最优解问题”。
8813
8914
回溯算法属于万金油,基本能用DP和贪心解决的题目都能用回溯暴力解决,不过回溯算法穷举的做法使得它的复杂度非常高,是指数级别的,所以只能适用于小规模数据的问题。
9015
9116
DP比回溯更高效,但并不是所有问题都可以通过DP解决的。能用DP解决的问题,需要满足最优子结构,无后效性,重复子问题这三个特征。DP之所以如此高效,原因就在于它通过合并重复的状态,来达到剪枝的目的(比如矩阵从左上角移动到右下角,求最短路径这个题目,要么下一步向右走,要么下一步向下走,我们选择那条之前状态是最短路径的那条,这样我们就打到了剪枝的目的).
9217
9318
94-
贪心算法能解决的问题更加局限。需要满足三个条件,最优子结构,无后效性和贪心选择性,即通过局部最优可以产生全局的最优选择。
95-
96-
97-
19+
贪心算法能解决的问题更加局限。需要满足三个条件,最优子结构,无后效性和贪心选择性,即通过局部最优可以产生全局的最优选择。-->
9820

21+
- [贪心](./greed.md)
22+
- [回溯算法](./backtracking.md)
23+
- [分治算法](./divideandconquer.md)
24+
- [动态规划](./dp.md)
25+
- [字符串匹配](./stringmatch.md)
26+
- [其他](./other.md)
9927

100-
## [贪心](./greed.md)
101-
## [回溯算法](./backtracking.md)
102-
## [分治算法](./divideandconquer.md)🚶🚶🚶🚶
103-
## [动态规划](./dp.md)
104-
105-
106-
## [字符串匹配](./stringmatch.md)
107-
108-
109-
## [其他](./other.md)
110-
111-
----------------
112-
-----------------
113-
------------------------
114-
------------------------
115-
----------------------------------
11628

11729
# **数据结构**
11830

119-
## [数组](./array.md)
120-
121-
## [链表](./linkedList.md)
122-
## [栈&队列](./stack_queue.md)
123-
124-
## [](./tree.md)
31+
- [数组](./array.md)
32+
- [链表](./linkedList.md)
33+
- [栈&队列](./stack_queue.md)
34+
- [](./tree.md)
35+
- [字符串](./string.md)
12536

126-
## [字符串](./string.md)
12737

38+
# [STL设计](./tiny_stl/README.md)
12839

40+
- iterator 【DONE】
41+
- vector 【DONE】
42+
- list 【DONE】
43+
- deque 【DONE】
44+
- unordered_map 【DONE】
45+
- map
12946

13047

13148

0 commit comments

Comments
 (0)