本博客LeetCode题解索引及各类算法问题小结汇总(C++实现)

Some explains:

1),The current problems have been solved:Welcome, EbowTangYou have solved 179 / 354 problems.(update::2016/07/05)

2),All problems are  coded with C++

3),There are 336 problems :about 55 problems for a fee,miss 10 problems(175-185)。

4),I will update this article for a long term.

5),I don't solve HARD problems.Just EASY and MEDIUM.


Linked List=List

Hash Table=HT / Hash

Two Points=TP

Dynamic Programming=DP

Math=Math

Backtracking=Btr

Binary Serch=BS

Bit Manipution=Bit


对于LeedCode的一些总结文章

自己的总结:

LeetCode总结,回溯法总结

LeetCode总结,二叉树各种类型问题小结

LeetCode总结,动态规划问题小结

LeetCode总结,递归的理解与设计

LeetCode总结,二分法一般性总结

LeetCode总结,分治法总结

贪心策略练习与总结

并查集及其常见面试题



别人的总结:

LeetCode总结--二分查找篇

LeetCode总结 -- 一维动态规划篇

LeetCode总结 -- 树的遍历篇

LeetCode总结 -- kSum篇

LeetCode总结 -- 数值计算篇

LeetCode总结 -- 一维数据合并篇

LeetCode总结 -- 树的求和篇

LeetCode总结 -- 树的性质篇

LeetCode总结 -- 高精度篇

LeetCode总结 -- 位运算篇

LeetCode总结 -- 矩阵篇

LeetCode总结 -- 图篇

LeetCode总结 -- 二叉查找树篇


# Problems key word Article Link
001 Two Sum HT    Click Here
002 Add Two Numbers List,Math    Click Here
003 Longest Substring Without Repeati… HT,TP    Click Here
004 Median of Two Sorted Arrays      Click Here
005 Longest Palindromic Substring String ,DP    Click Here
006 ZigZag Conversion      Click Here
007 Reverse Integer Math    Click Here
008 String to Integer Math,String    Click Here
009 Palindrome Number Math

   Click Here

010 Regular Expression Matching      Click Here
011 Container With Most Water      Click Here
012 Integer to Roman Math    Click Here
013 Roman to Integer Math    Click Here
014 Longest Common Prefix String    Click Here
015 3Sum TP    Click Here
016 3Sum Closest TP,Array    Click Here
017 Letter Combinations of a Phone Number Btr    Click Here
018 4Sum TP,Array    Click Here
019 Remove Nth Node From End of List List    Click Here
020 Valid Parentheses Stack,String    Click Here
021 Merge Two Sorted Lists List    Click Here
022 Generate Parentheses Backtracking    Click Here
023 Merge k Sorted Lists      Click Here
024 Swap Nodes in Pairs List
   Click Here
025 Reverse Nodes in k-Group
   Click Here
026 Remove Duplicates from Sorted Array TP,Array    Click Here
027 Remove Element TP    Click Here
028 Implement strStr() KMP,String    Click Here
029 Divide Two Integers
   Click Here
030 Substring with Concatenation of A…
   Click Here
031 Next Permutation Math    Click Here
032 Longest Valid Parentheses
   Click Here
033 Search in Rotated Sorted Array
   Click Here
034 Search for a Range BS    Click Here
035 Search Insert Position BS    Click Here
036 Valid Sudoku
   Click Here
037 Sudoku Solver
   Click Here
038 Count and Say String    Click Here
039 Combination Sum Btr    Click Here
040 Combination Sum II Btr    Click Here
041 First Missing Positive
   Click Here
042 Trapping Rain Water
   Click Here
043 Multiply Strings Math    Click Here
044 Wildcard Matching      Click Here
045 Jump Game II      Click Here
046 Permutations  Backtracking    Click Here
047 Permutations II  Btr    Click Here
048 Rotate Image  Array    Click Here
049 Anagrams  HT,String    Click Here
050 Pow(x, n)  Math,BS    Click Here
051 N-Queens      Click Here
052 N-Queens II  Btr    Click Here
053 Maximum Subarray  DP    Click Here
054 Spiral Matrix  Array    Click Here
055 Jump Game  Greedy    Click Here
056 Merge Intervals      Click Here
057 Insert Interval      Click Here
058 Length of Last Word   String    Click Here
059 Spiral Matrix II   Array    Click Here
060 Permutation Sequence   DFS,Math    Click Here
061 Rotate List   List    Click Here
062 Unique Paths   DP    Click Here
063 Unique Paths II   DP    Click Here
064 Minimum Path Sum   DP    Click Here
065 Valid Number       Click Here
066 Plus One   Math    Click Here
067 Add Binary   Math,String    Click Here
068 Text Justification       Click Here
069 Sqrt(x)   Math    Click Here
070 Climbing Stairs   DP    Click Here
071 Simplify Path       Click Here
072 Edit Distance       Click Here
073 Set Matrix Zeroes   Array    Click Here
074 Search a 2D Matrix   BS    Click Here
075 Sort Colors   TP,Sort    Click Here
076 Minimum Window Substring        Click Here
077 Combinations   Btr    Click Here
078 Subsets   Btr    Click Here
079 Word Search       Click Here
080 Remove Duplicates from Sorted Array II   TP,Array    Click Here
081 Search in Rotated Sorted Array II        Click Here
082 Remove Duplicates from Sorted List II      Click Here
083 Remove Duplicates from Sorted List   List    Click Here
084 Largest Rectangle in Histogram      Click Here
085 Maximal Rectangle      Click Here
086 Partition List   List,TP    Click Here
087 Scramble String       Click Here
088 Merge Sorted Array   TP    Click Here
089 Gray Code   Btr,Math    Click Here
090 Subsets II   Btr    Click Here
091 Decode Ways        Click Here
092 Reverse Linked List II       Click Here
093 Restore IP Addresses         Click Here
094 Binary Tree Inorder Traversal   Binary Tree    Click Here
096 Unique Binary Search Trees   DP    Click Here
095 Unique Binary Search Trees II       Click Here
097 Interleaving String       Click Here
098 Validate Binary Search Tree          Click Here
099 Recover Binary Search Tree
   Click Here
100 Same Tree  DFS,Tree    Click Here
101 Symmetric Tree  DFS,Tree    Click Here
102 Binary Tree Level Order Traversal  BFS,Tree    Click Here
103 Binary Tree Zigzag Level Order Traversal  BFS,Tree    Click Here
104 Maximum Depth of Binary Tree  DFS,Tree    Click Here
105 Construct Binary Tree from Preord…  Tree    Click Here
106 Construct Binary Tree from Inorde…  Tree    Click Here
107 Binary Tree Level Order Traversal II   BFS,Tree    Click Here
108 Convert Sorted Array to Binary Se…  Tree ,BFS    Click Here
109 Convert Sorted List to Binary Sea…  Tree,List    Click Here
110 Balanced Binary Tree   DFS    Click Here
111 Minimum Depth of Binary Tree   DFS,Tree    Click Here
112 Path Sum   DFS,Tree    Click Here
113 Path Sum II   DFS,Tree    Click Here
114 Flatten Binary Tree to Linked List   DFS,Tree    Click Here
115 Distinct Subsequences        Click Here
116 Populating Next Right Pointers in…   Tree ,BFS,DFS    Click Here
117 Populating Next Right Pointers in…   Tree,BFS,DFS    Click Here
118 Pascals Triangle    Array,Math    Click Here
119 Pascal’s Triangle II    Array,Math    Click Here
120 Triangle    DP    Click Here
121 Best Time to Buy and Sell Stock    DP    Click Here
122 Best Time to Buy and Sell Stock II    DP    Click Here
123 Best Time to Buy and Sell Stock III    DP    Click Here
124 Binary Tree Maximum Path Sum      Click Here
125 Valid Palindrome    TP,String    Click Here
126 Word Ladder
   Click Here
127 Word Ladder II      Click Here
128 Longest Consecutive Sequence      Click Here
129 Sum Root to Leaf Numbers    Tree,DFS    Click Here
130 Surrounded Regions    BFS,Union    Click Here
131 Palindrome Partitioning       Click Here
132 Palindrome Partitioning II       Click Here
133 Clone Graph   Graph,DFS,BFS    Click Here
134 Gas Station        Click Here
135 Candy      Click Here
136 Single Number    HS,Bit    Click Here
137 Single Number II    HS,Bit    Click Here
138 Copy List with Random Pointer        Click Here
139 Word Break      Click Here
140 Word Break II      Click Here
141 Linked List Cycle     Linked List    Click Here
142 Linked List Cycle II   Linked List    Click Here
143 Reorder List        Click Here
144 Binary Tree Preorder Traversal    Binary Tree    Click Here
145 Binary Tree Postorder Traversal    Binary Tree    Click Here
146 LRU Cache      Click Here
147 Insertion Sort List        Click Here
148 Sort List    List    Click Here
149 Max Points on a Line      Click Here
150 Evaluate Reverse Polish Notation        Click Here
151 Reverse Words in a String   String    Click Here
152 Maximum Product Subarray   DP    Click Here
153 Find Minimum in Rotated Sorted Array        Click Here
154 Find Minimum in Rotated Sorted Array II        Click Here
155 Min Stack        Click Here
156 Binary Tree Upside Down $       Not Buy
157 Read N Characters Given Read4 $       Not Buy
158 Read N Characters Given Read4 II … $       Not Buy
159 Longest Substring with At Most Tw… $       Not Buy
160 Intersection of Two Linked Lists    List    Click Here
161 One Edit Distance $    Not Buy     Not Buy
162 Find Peak Element    BS    Click Here
163 Missing Ranges $       Not Buy
164 Maximum Gap          Click Here
165 Compare Version Numbers          Click Here
166 Fraction to Recurring Decimal
   Click Here
167 Two Sum II - Input array is sorted $    Not Buy     Not Buy
168 Excel Sheet Column Title    Math    Click Here
169 Majority Element    Math,Bit    Click Here
170 Two Sum III - Data structure design $       Not Buy
171 Excel Sheet Column Number    Math    Click Here
172 Factorial Trailing Zeroes        Click Here
173 Binary Search Tree Iterator    Tree    Click Here
174 Dungeon Game      Click Here
175 Combine Two Tables          Click Here
176 Second Highest Salary        Click Here
177 Nth Highest Salary      Click Here
178 Rank Scores         Click Here
179 Largest Number    Sort,String    Click Here
180 Consecutive Numbers         Click Here
181 Employees Earning More Than Their…             Click Here
182 Duplicate Emails      Click Here
183 Customers Who Never Order             Click Here
184 Department Highest Salary       Click Here
185 Department Top Three Salaries      Click Here
186 Reverse Words in a String II $       Not Buy
187 Repeated DNA Sequences           Click Here
188 Best Time to Buy and Sell Stock IV    DP     Click Here
189 Rotate Array     Array     Click Here
190 Reverse Bits    Bit     Click Here
191 Number of 1 Bits    Bit     Click Here
192 Word Frequency         Click Here
193 Valid Phone Numbers         Click Here
194 Transpose File       Click Here
195 Tenth Line       Click Here
196 Delete Duplicate Emails       Click Here
197 Rising Temperature
    Click Here
198 House Robber    DP     Click Here
199 Binary Tree Right Side View    Tree,BFS     Click Here
200 Number of Islands    DFS,Union     Click Here
201 Bitwise AND of Numbers Range    Bit     Click Here
202 Happy Number     Hash     Click Here
203 Remove Linked List Elements     List     Click Here
204 Count Primes     Math     Click Here
205 Isomorphic Strings     Hash Table     Click Here
206 Reverse Linked List     List     Click Here
207 Course Schedule       Click Here
208 Implement Trie (Prefix Tree)       Click Here
209 Minimum Size Subarray Sum     TP,BS     Click Here
210 Course Schedule II       Click Here
211 Add and Search Word - Data struct…       Click Here
212 Word Search II       Click Here
213 House Robber II     DP     Click Here
214 Shortest Palindrome       Click Here
215 Kth Largest Element in an Array     Heap, Quick Sort      Click Here
216 Combination Sum III     Btr      Click Here
217 Contains Duplicate     Hash      Click Here
218 The Skyline Problem        Click Here
219 Contains Duplicate II     Hash      Click Here
220 Contains Duplicate III         Click Here
221 Maximal Square        Click Here
222 Count Complete Tree Nodes        Click Here
223 Rectangle Area     Math      Click Here
224 Basic Calculator        Click Here
225 Implement Stack using Queues     Stack,Queue      Click Here
226 Invert Binary Tree     Tree      Click Here
227 Basic Calculator II        Click Here
228 Summary Ranges     Two Points      Click Here
229 Majority Element II        Click Here
230 Kth Smallest Element in a BST     Tree      Click Here
231 Power of Two     Bit,Math      Click Here
232 Implement Queue using Stacks     Queue,Stack      Click Here
233 Number of Digit One        Click Here
234 Palindrome Linked List     List      Click Here
235 Lowest Common Ancestor of a Binar…     Tree      Click Here
236 Lowest Common Ancestor of a Binary Tree     Tree      Click Here
237 Delete Node in a Linked List      List      Click Here
238 Product of Array Except Self      Math      Click Here
239 Sliding Window Maximum        Click Here
240 Search a 2D Matrix II      BS      Click Here
241 Different Ways to Add Parentheses      Divide      Click Here
242 Valid Anagram      Hash,Sort      Click Here
243 Shortest Word Distance        Not Buy
244 Shortest Word Distance II         Not Buy
245 Shortest Word Distance III         Not Buy
246 Strobogrammatic Number         Not Buy
247 Strobogrammatic Number II         Not Buy
248 Strobogrammatic Number III         Not Buy
249 Group Shifted Strings        Not Buy
250 Count Univalue Subtrees        Not Buy
251 Flatten 2D Vector        Not Buy
252 Meeting Rooms        Not Buy
253 Meeting Rooms II        Not Buy
254 Factor Combinations         Not Buy
255 Verify Preorder Sequence in Binary Search Tree        Not Buy
256 Paint House         Click Here
257 Binary Tree Paths      DFS,Tree      Click Here
258 Add Digits      Math      Click Here
259 3Sum Smaller         Click Here
260 Single Number III      Hash,Bit      Click Here
261 Graph Valid Tree        Click Here
262 NULL      NULL      NULL
263 Ugly Number      Math      Click Here
264 Ugly Number II      DP,Heap,Math      Click Here
266 Palindrome Permutation         Click Here
267 Palindrome Permutation II        Click Here
268 Missing Number      Math,Bit      Click Here
269 Alien Dictionary        Click Here
270 Closest Binary Search Tree Value         Click Here
271 Encode and Decode Strings        Click Here
272 Closest Binary Search Tree Value II         Click Here
273 Integer to English Words        Click Here
274 H-Index    Array      Click Here
275 H-Index II    BS      Click Here
276 Paint Fence        Click Here
277 Find the Celebrity        Click Here
278 First Bad Version     BS      Click Here
279 Perfect Squares        Click Here
280 Wiggle Sort         Click Here
281 Zigzag Iterator        Click Here
282 Expression Add Operators        Click Here
283 Move Zeroes     TP      Click Here
284 Peeking Iterator        Click Here
285 Inorder Successor in BST         Click Here
286 Walls and Gates        Click Here
287 Find the Duplicate Number     TP,BS      Click Here
288 Unique Word Abbreviation        Click Here
289 Game of Life        Click Here
290 Word Pattern     Hash       Click Here
291 Word Pattern II        Not Buy
292 Nim Game        Click Here
293 Flip Game        Click Here
294 Flip Game II         Click Here
295 Find Median from Data Stream        Click Here
296 Best Meeting Point        Click Here
297 Serialize and Deserialize Binary Tree        Click Here
298 Binary Tree Longest Consecutive Sequence        Click Here
299 Bulls and Cows        Click Here
300 Longest Increasing Subsequence        Click Here
301 Remove Invalid Parentheses        Click Here
302 Smallest Rectangle Enclosing Black Pixels        Click Here
303 Range Sum Query - Immutable     DP      Click Here
304 Range Sum Query 2D - Immutable        Click Here
305 Number of Islands II        Click Here
306 Additive Number        Click Here
307 Range Sum Query - Mutable        Click Here
308 Range Sum Query 2D - Mutable        Click Here
309 Best Time to Buy and Sell Stock....        Click Here
310 Minimum Height Trees        Click Here
311 Sparse Matrix Multiplication        Click Here
312 Burst Balloons    Math      Click Here
313 Super Ugly Number    DP,Heap      Click Here
314 Binary Tree Vertical Order Traversal         Click Here
315 Count of Smaller Numbers After Self        Click Here
316 Remove Duplicate Letters        Click Here
317 Shortest Distance from All Buildings        Click Here
318 Maximum Product of Word Lengths    String,Bit      Click Here
319 Bulb Switcher    Math      Click Here
320 Generalized Abbreviation        Click Here
321 Create Maximum Number        Click Here
322 Coin Change        Click Here
323 Number of Connected Components...        Click Here
324 Wiggle Sort II        Click Here
325 Maximum Size Subarray Sum Equals k        Not Buy
326 Power of Three    Math      Click Here
327 Count of Range Sum    Divide       Click Here
328 Odd Even Linked List    List      Click Here
329 Longest Increasing Path in a Matrix        Click Here
330 Patching Array        Click Here
331 Verify Preorder Serialization of a BTree        Click Here
332 Reconstruct Itinerary        Click Here
333 Largest BST Subtree        Click Here
334 Increasing Triplet Subsequence    Array,DP      Click Here
335 Self Crossing        Click Here
336 Palindrome Pairs        Click Here
337 House Robber III        Click Here
338 Counting Bits    DP,Bit      Click Here
339 Nested List Weight Sum         Click Here
340 Longest Substring with At Most K Distinct Characters         Click Here
341 Flatten Nested List Iterator        Click Here
342 Power of Four    Math      Click Here
343 Integer Break    Math      Click Here
344 Reverse String    String      Click Here
345 Reverse Vowels of a String    String,TP      Click Here
346 Moving Average from Data Stream     Not Buy      Not Buy
347 Top K Frequent Elements    Hash,Heap      Click Here
348 Design Tic-Tac-Toe     Not Buy      Not Buy
349 Intersection of Two Arrays    Hash,BS,      Click Here
350 Intersection of Two Arrays II    TP,Hash      Click Here



注:本博文为EbowTang原创,后续可能继续更新本文。如果转载,请务必复制本条信息!

原文地址:http://blog.csdn.net/ebowtang/article/details/50668895

原作者博客:http://blog.csdn.net/ebowtang

你可能感兴趣的:(LeetCode,OJ,LeetCode解题报告)