全部最新的题解可以在 我的 github 上找,欢迎 star 和 watch ~
更新中~~
这个系列的题解包括用 C++/Java/Python 写的 leetcode 上的算法题目,和 Sql 写的 leetcode 上的数据库题目。
有些题目虽然 AC 了却还没写分析,所以这次就开坑来完成。
我的 github
Leetcode Algorithms Problems
Leetcode Database Problems
(最近见 我的 github )
There are 241 problems (9 problems for a fee).
I have solved 201 / 232 problems.=w=
# | Problems | Solutions | Note |
---|---|---|---|
001 | Two Sum | C++ Java Python | Note Here |
002 | Add Two Numbers | C++ Java Python | Note Here |
003 | Longest Substring Without Repeati… | C++ Java Python | Note Here |
004 | Median of Two Sorted Arrays | C++ Java Python | Note Here |
005 | Longest Palindromic Substring | C++ Java Python | Note Here |
006 | ZigZag Conversion | C++ Java Python | Note Here |
007 | Reverse Integer | C++ Java Python | Note Here |
008 | String to Integer | C++ Java Python | Note Here |
009 | Palindrome Number | C++ Java Python | Note Here |
010 | Regular Expression Matching | C++ Java Python | Note Here |
011 | Container With Most Water | C++ Java Python | Note Here |
012 | Integer to Roman | C++ Java Python | Note Here |
013 | Roman to Integer | C++ Java Python | Note Here |
014 | Longest Common Prefix | C++ Java Python | Note Here |
015 | 3Sum | C++ Java Python | Note Here |
016 | 3Sum Closest | C++ Java Python | Note Here |
017 | Letter Combinations of a Phone Number | C++ Java Python | Note Here |
018 | 4Sum | C++ Java Python | Note Here |
019 | Remove Nth Node From End of List | C++ Python | Note Here |
020 | Valid Parentheses | C++ Java Python | Note Here |
021 | Merge Two Sorted Lists | C++ Python | Note Here |
022 | Generate Parentheses | C++ Java Python | Note Here |
023 | Merge k Sorted Lists | C++ Java Python | Note Here |
024 | Swap Nodes in Pairs | C++ Python | Note Here |
025 | Reverse Nodes in k-Group | C++ Java | Note Here |
026 | Remove Duplicates from Sorted Array | C++ | Note Here |
027 | Remove Element | C++ | Note Here |
028 | Implement strStr() | C++ Python | Note Here |
029 | Divide Two Integers | C++ Python | Note Here |
030 | Substring with Concatenation of A… | C++ Java | Note Here |
031 | Next Permutation | C++ Python | Note Here |
032 | Longest Valid Parentheses | C++ | Note Here |
033 | Search in Rotated Sorted Array | C++ | Note Here |
034 | Search for a Range | C++ Java | Note Here |
035 | Search Insert Position | C++ | Note Here |
036 | Valid Sudoku | C++ | Note Here |
037 | Sudoku Solver | C++ | Note Here |
038 | Count and Say | C++ Python | Note Here |
039 | Combination Sum | C++ | Coming soon |
040 | Combination Sum II | C++ | Coming soon |
041 | First Missing Positive | C++ | Coming soon |
042 | Trapping Rain Water | C++ | Coming soon |
043 | Multiply Strings | C++ | Coming soon |
044 | Wildcard Matching | C++ | Coming soon |
045 | Jump Game II | C++ | Coming soon |
046 | Permutations | C++ | Coming soon |
047 | Permutations II | C++ | Coming soon |
048 | Rotate Image | C++ | Coming soon |
049 | Anagrams | C++ | Coming soon |
050 | Pow(x, n) | C++ | Coming soon |
051 | N-Queens | C++ Java Python | Coming soon |
052 | N-Queens II | C++ Java Python | Coming soon |
053 | Maximum Subarray | C++ | Coming soon |
054 | Spiral Matrix | C++ | Coming soon |
055 | Jump Game | C++ | Coming soon |
056 | Merge Intervals | C++ | Coming soon |
057 | Insert Interval | C++ | Coming soon |
058 | Length of Last Word | C++ | Coming soon |
059 | Spiral Matrix II | C++ | Coming soon |
060 | Permutation Sequence | C++ | Coming soon |
061 | Rotate List | C++ | Coming soon |
062 | Unique Paths | C++ | Coming soon |
063 | Unique Paths II | C++ | Coming soon |
064 | Minimum Path Sum | C++ | Coming soon |
065 | Valid Number | C++ Java Python | Coming soon |
066 | Plus One | C++ | Coming soon |
067 | Add Binary | C++ | Coming soon |
068 | Text Justification | C++ Java Python | Note Here |
069 | Sqrt(x) | C++ Java Python | Coming soon |
070 | Climbing Stairs | C++ | Coming soon |
071 | Simplify Path | C++ Java Python | Coming soon |
072 | Edit Distance | C++ | Coming soon |
073 | Set Matrix Zeroes | C++ | Coming soon |
074 | Search a 2D Matrix | C++ | Coming soon |
075 | Sort Colors | C++ | Coming soon |
076 | Minimum Window Substring | C++ | Note Here |
077 | Combinations | C++ | Coming soon |
078 | Subsets | C++ Java Python | Coming soon |
079 | Word Search | C++ | Coming soon |
080 | Remove Duplicates from Sorted Array II | C++ | Coming soon |
081 | Search in Rotated Sorted Array II | C++ | Coming soon |
082 | Remove Duplicates from Sorted List II | C++ | Coming soon |
083 | Remove Duplicates from Sorted List | C++ | Coming soon |
084 | Largest Rectangle in Histogram | C++ Java | Note Here |
085 | Maximal Rectangle | C++ Java | Note Here |
086 | Partition List | C++ Java Python | Coming soon |
087 | Scramble String | C++ Java Python | Note Here |
088 | Merge Sorted Array | C++ | Coming soon |
089 | Gray Code | C++ Java Python | Coming soon |
090 | Subsets II | C++ Java Python | Coming soon |
091 | Decode Ways | C++ Java Python | Coming soon |
092 | Reverse Linked List II | C++ | Coming soon |
093 | Restore IP Addresses | C++ Java Python | Note Here |
094 | Binary Tree Inorder Traversal | C++ | Coming soon |
095 | Unique Binary Search Trees | C++ | Note Here |
096 | Unique Binary Search Trees II | C++ | Note Here |
097 | Interleaving String | C++ Java | Note Here |
098 | Validate Binary Search Tree | C++ Java Python | Note Here |
099 | Recover Binary Search Tree | C++ Python | Note Here |
100 | Same Tree | C++ | Coming soon |
101 | Symmetric Tree | C++ | Coming soon |
102 | Binary Tree Level Order Traversal | C++ Python | Note Here |
103 | Binary Tree Zigzag Level Order Traversal | C++ Python | Note Here |
104 | Maximum Depth of Binary Tree | C++ | Coming soon |
105 | Construct Binary Tree from Preord… | C++ | Note Here |
106 | Construct Binary Tree from Inorde… | C++ | Note Here |
107 | Binary Tree Level Order Traversal II | C++ Python | Note Here |
108 | Convert Sorted Array to Binary Se… | C++ | Note Here |
109 | Convert Sorted List to Binary Sea… | C++ Python | Note Here |
110 | Balanced Binary Tree | C++ | Coming soon |
111 | Minimum Depth of Binary Tree | C++ | Coming soon |
112 | Path Sum | C++ | Coming soon |
113 | Path Sum II | C++ Java Python | Coming soon |
114 | Flatten Binary Tree to Linked List | C++ Java | Note Here |
115 | Distinct Subsequences | C++ Python | Note Here |
116 | Populating Next Right Pointers in… | C++ Java Python | Coming soon |
117 | Populating Next Right Pointers in… | C++ Java Python | Coming soon |
118 | Pascals Triangle | C++ | Coming soon |
119 | Pascal’s Triangle II | C++ | Coming soon |
120 | Triangle | C++ Java Python | Coming soon |
121 | Best Time to Buy and Sell Stock | C++ Python | Note Here |
122 | Best Time to Buy and Sell Stock II | C++ Python | Note Here |
123 | Best Time to Buy and Sell Stock III | C++ Python | Note Here |
124 | Binary Tree Maximum Path Sum | C++ Python | Note Here |
125 | Valid Palindrome | C++ | Coming soon |
126 | Word Ladder | C++ Python | Note Here |
127 | Word Ladder II | Coming soon | Coming soon |
128 | Longest Consecutive Sequence | Coming soon | Coming soon |
129 | Sum Root to Leaf Numbers | C++ | Coming soon |
130 | Surrounded Regions | C++ | Note Here |
131 | Palindrome Partitioning | C++ Python | Note Here |
132 | Palindrome Partitioning II | C++ Java | Note Here |
133 | Clone Graph | C++ | Coming soon |
134 | Gas Station | C++ | Note Here |
135 | Candy | Coming soon | Coming soon |
136 | Single Number | C++ | Coming soon |
137 | Single Number II | C++ | Coming soon |
138 | Copy List with Random Pointer | C++ Java Python | Note Here |
139 | Word Break | C++ Python | Note Here |
140 | Word Break II | Coming soon | Coming soon |
141 | Linked List Cycle | C++ | Coming soon |
142 | Linked List Cycle II | Coming soon | Coming soon |
143 | Reorder List | C++ | Coming soon |
144 | Binary Tree Preorder Traversal | C++ | Coming soon |
145 | Binary Tree Postorder Traversal | C++ | Coming soon |
146 | LRU Cache | C++ Python | Note Here |
147 | Insertion Sort List | C++ | Coming soon |
148 | Sort List | C++ | Note Here |
149 | Max Points on a Line | Coming soon | Coming soon |
150 | Evaluate Reverse Polish Notation | C++ Java Python | Note Here |
151 | Reverse Words in a String | C++ Java Python | Note Here |
152 | Maximum Product Subarray | C++ | Coming soon |
153 | Find Minimum in Rotated Sorted Array | C++ | Note Here |
154 | Find Minimum in Rotated Sorted Array II | C++ Python | Note Here |
155 | Min Stack | C++ | Coming soon |
156 | Binary Tree Upside Down $ | Not Buy | Not Buy |
157 | Read N Characters Given Read4 $ | Not Buy | Not Buy |
158 | Read N Characters Given Read4 II … $ | Not Buy | Not Buy |
159 | Longest Substring with At Most Tw… $ | Not Buy | Not Buy |
160 | Intersection of Two Linked Lists | C++ | Coming soon |
161 | One Edit Distance $ | Not Buy | Not Buy |
162 | Find Peak Element | C++ Java Python | Coming soon |
163 | Missing Ranges $ | Not Buy | Not Buy |
164 | Maximum Gap | C++ | Note Here |
165 | Compare Version Numbers | C++ | Coming soon |
166 | Fraction to Recurring Decimal | C++ | Note Here |
167 | Two Sum II - Input array is sorted $ | Not Buy | Not Buy |
168 | Excel Sheet Column Title | C++ Java Python | Coming soon |
169 | Majority Element | C++ Java Python | Coming soon |
170 | Two Sum III - Data structure design $ | Not Buy | Not Buy |
171 | Excel Sheet Column Number | C++ Java Python | Coming soon |
172 | Factorial Trailing Zeroes | C++ Java Python | Coming soon |
173 | Binary Search Tree Iterator | C++ Python | Note Here |
174 | Dungeon Game | Coming soon | Coming soon |
175 | Combine Two Tables | SQL | Coming soon |
176 | Second Highest Salary | SQL | Coming soon |
177 | Nth Highest Salary | SQL | Note Here |
178 | Rank Scores | SQL | Note Here |
179 | Largest Number | C++ Java Python | Coming soon |
180 | Consecutive Numbers | SQL | Note Here |
181 | Employees Earning More Than Their… | SQL | Coming soon |
182 | Duplicate Emails | SQL | Coming soon |
183 | Customers Who Never Order | SQL | Note Here |
184 | Department Highest Salary | SQL | Note Here |
185 | Department Top Three Salaries | Coming soon | Coming soon |
186 | Reverse Words in a String II $ | Not Buy | Not Buy |
187 | Repeated DNA Sequences | C++ Java Python | Coming soon |
188 | Best Time to Buy and Sell Stock IV | C++ | Note Here |
189 | Rotate Array | C++ | Note Here |
190 | Reverse Bits | C++ Java Python | Note Here |
191 | Number of 1 Bits | C++ Java | Note Here |
192 | Word Frequency | Shell Script | Note Here |
193 | Valid Phone Numbers | Shell Script | Note Here |
194 | Transpose File | Shell Script | Note Here |
195 | Tenth Line | Shell Script | Note Here |
196 | Delete Duplicate Emails | SQL | Coming soon |
197 | Rising Temperature | SQL | Note Here |
198 | House Robber | C++ | Note Here |
199 | Binary Tree Right Side View | C++ Python | Note Here |
200 | Number of Islands | C++ | Note Here |
201 | Bitwise AND of Numbers Range | C++ Python | Note Here |
202 | Happy Number | C++ Python | Note Here |
203 | Remove Linked List Elements | C++ Java Python | Note Here |
204 | Count Primes | C++ | Coming soon |
205 | Isomorphic Strings | C++ Python | Note Here |
206 | Reverse Linked List | C++ | Coming soon |
207 | Course Schedule | Coming soon | Coming soon |
208 | Implement Trie (Prefix Tree) | Coming soon | Coming soon |
209 | Minimum Size Subarray Sum | Coming soon | Coming soon |
210 | Course Schedule II | Coming soon | Coming soon |
211 | Add and Search Word - Data struct… | Coming soon | Coming soon |
212 | Word Search II | Coming soon | Coming soon |
213 | House Robber II | Coming soon | Coming soon |
214 | Shortest Palindrome | Coming soon | Coming soon |
215 | Kth Largest Element in an Array | Coming soon | Coming soon |
216 | Combination Sum III | Coming soon | Coming soon |
217 | Contains Duplicate | C++ Python | Note Here |
218 | The Skyline Problem | Coming soon | Coming soon |
219 | Contains Duplicate II | C++ | Note Here |
220 | Contains Duplicate III | C++ Java | Note Here |
221 | Maximal Square | Coming soon | Coming soon |
222 | Count Complete Tree Nodes | Coming soon | Coming soon |
223 | Rectangle Area | C++ | Note Here |
224 | Basic Calculator | Coming soon | Coming soon |
225 | Implement Stack using Queues | C++ Java | Note Here |
226 | Invert Binary Tree | C++ Python | Note Here |
227 | Basic Calculator II | Coming soon | Coming soon |
228 | Summary Ranges | C++ Python | Note Here |
229 | Majority Element II | Coming soon | Coming soon |
230 | Kth Smallest Element in a BST | Coming soon | Coming soon |
231 | Power of Two | C++ Python | Note Here |
232 | Implement Queue using Stacks | C++ Python | Note Here |
233 | Number of Digit One | Coming soon | Coming soon |
234 | Palindrome Linked List | C++ Java Python | Note Here |
235 | Lowest Common Ancestor of a Binar… | C++ Python | Note Here |
236 | Lowest Common Ancestor of a Binary Tree | Coming soon | Coming soon |
237 | Delete Node in a Linked List | C++ Python | Note Here |
238 | Product of Array Except Self | Coming soon | Coming soon |
239 | Sliding Window Maximum | Coming soon | Coming soon |
240 | Search a 2D Matrix II | Coming soon | Coming soon |
241 | Different Ways to Add Parentheses | Coming soon | Coming soon |
如果有什么错误请指出来,欢迎探讨~
留言或 Email: iilluzen at google’s mail service