LeetCodes

LeetCode 题解

本部分是LeetCode的刷题记录,我会在刷题的过程中一点一点更新上去,现所有题目使用C++进行编写,点击题目链接即可看到详细内容,欢迎读者指出不足之处,欢迎与我交流讨论!!


# Title Difficulity Language Accepted
1 Two Sum Easy C++
2 Add Two Numbers Medium C++
3 Longest Substring Without Repeating Characters Medium C++
4 Median of Two Sorted Arrays Hard C++
5 Longest Palindromic Substring Medium C++
6 ZigZag Conversion Easy C++
7 Reverse Integer Easy C++
8 String to Integer (atoi) Easy C++
9 Palindrome Number Easy C++
10 Regular Expression Matching Hard C++
11 Container With Most Water Medium C++
12 Integer to Roman Medium C++
13 Roman to Integer Easy C++
14 Longest Common Prefix Easy C++
15 3Sum Medium C++
16 3Sum Closest Medium C++
17 Letter Combinations of a Phone Number Medium C++
18 4Sum Medium C++
19 Remove Nth Node From End of List Easy C++
20 Valid Parentheses Easy C++
21 Merge Two Sorted Lists Easy C++
22 Generate Parentheses Medium C++
23 Merge k Sorted Lists Hard C++
24 Swap Nodes in Pairs Easy C++
25 Reverse Nodes in k-Group Hard C++
26 Remove Duplicates from Sorted Array Easy C++
27 Remove Element Easy C++
28 Implement strStr() Easy C++
29 Divide Two Integers Medium C++
30 Substring with Concatenation of All Words Hard C++
31 Next Permutation Medium C++
32 Longest Valid Parentheses Hard C++
33 Search in Rotated Sorted Array Hard C++
34 Search for a Range Medium C++
35 Search Insert Position Medium C++
36 Valid Sudoku Easy C++
37 Sudoku Solver Hard C++
38 Count and Say Easy C++
39 Combination Sum Medium C++
40 Combination Sum II Medium C++
41 First Missing Positive Hard C++
42 Trapping Rain Water Hard C++
43 Multiply Strings Medium C++
44 Wildcard Matching Hard C++
45 Jump Game II Hard C++
46 Permutations Medium C++
47 Permutations II Medium C++
48 Rotate Image Medium C++
49 Group Anagrams Medium C++
50 Pow(x, n) Medium C++
51 N-Queens Hard C++
52 N-Queens II Hard C++
53 Maximum Subarray Medium C++
54 Spiral Matrix Medium C++
55 Jump Game Medium C++
56 Merge Intervals Hard C++
57 Insert Interval Hard C++
58 Length of Last Word Easy C++
59 Spiral Matrix II Medium C++
60 Permutation Sequence Medium C++
61 Rotate List Medium C++
62 Unique Paths Medium C++
63 Unique Paths II Medium C++
64 Minimum Path Sum Medium C++
65 Valid Number Hard C++
66 Plus One Easy C++
67 Add Binary Easy C++
68 Text Justification Hard C++
69 Sqrt(x) Medium C++
70 Climbing Stairs Easy C++
71 Simplify Path Medium C++
72 Edit Distance Hard C++
73 Set Matrix Zeroes Medium C++
74 Search a 2D Matrix Medium C++
75 Sort Colors Medium C++
76 Minimum Window Substring Hard C++
77 Combinations Medium C++
78 Subsets Medium C++
79 Word Search Medium C++
80 Remove Duplicates from Sorted Array II Medium C++
81 Search in Rotated Sorted Array II Medium C++
82 Remove Duplicates from Sorted List II Medium C++
83 Remove Duplicates from Sorted List Easy C++
84 Largest Rectangle in Histogram Hard C++
85 Maximal Rectangle Hard C++
86 Partition List Medium C++
87 Scramble String Hard C++
88 Merge Sorted Array Easy C++
89 Gray Code Medium C++
90 Subsets II Medium C++
91 Decode Ways Medium C++
92 Reverse Linked List II Medium C++
93 Restore IP Addresses Medium C++
94 Binary Tree Inorder Traversal Medium C++
95 Unique Binary Search Trees II Medium C++
96 Unique Binary Search Trees Medium C++
97 Interleaving String Hard C++
98 Validate Binary Search Tree Medium C++
99 Recover Binary Search Tree Hard C++
100 Same Tree Easy C++
101 Symmetric Tree Easy C++
102 Binary Tree Level Order Traversal Easy C++
103 Binary Tree Zigzag Level Order Traversal Medium C++
104 Maximum Depth of Binary Tree Easy C++
105 Construct Binary Tree from Preorder and Inorder Traversal Medium C++
106 Construct Binary Tree from Inorder and Postorder Traversal Medium C++
107 Binary Tree Level Order Traversal II Easy C++
108 Convert Sorted Array to Binary Search Tree Medium C++
109 Convert Sorted List to Binary Search Tree Medium C++
110 Balanced Binary Tree Easy C++
111 Minimum Depth of Binary Tree Easy C++
112 Path Sum Easy C++
113 Path Sum II Medium C++
114 Flatten Binary Tree to Linked List Medium C++
116 Populating Next Right Pointers in Each Node Medium C++
117 Populating Next Right Pointers in Each Node II Hard C++
122 Best Time to Buy and Sell Stock II Easy C++
124 Binary Tree Maximum Path Sum Hard C++
129 Sum Root to Leaf Numbers Medium C++
134 Gas Station Medium C++
135 Candy Hard C++
136 Single Number Easy C++
137 Single Number II Medium C++
138 Copy List with Random Pointer Hard C++
141 Linked List Cycle Easy C++
142 Linked List Cycle II Medium C++
143 Reorder List Medium C++
144 Binary Tree Preorder Traversal Medium C++
145 Binary Tree Postorder Traversal Hard C++
147 Insertion Sort List Medium C++
148 Sort List Medium C++
160 Intersection of Two Linked Lists Easy C++
169 Majority Element Easy C++
173 Binary Search Tree Iterator Medium C++
174 Dungeon Game Hard C++
187 Repeated DNA Sequences Medium C++
189 Rotate Array Easy C++
190 Reverse Bits Easy C++
191 Number of 1 Bits Easy C++
199 Binary Tree Right Side View Medium C++
201 Bitwise AND of Numbers Range Medium C++
203 Remove Linked List Elements Easy C++
206 Reverse Linked List Easy C++
209 Minimum Size Subarray Sum Medium C++
215 Kth Largest Element in an Array Medium C++
216 Combination Sum III Medium C++
218 The Skyline Problem Hard C++
222 Count Complete Tree Nodes Medium C++
226 Invert Binary Tree Easy C++
230 Kth Smallest Element in a BST Medium C++
231 Power of Two Easy C++
234 Palindrome Linked List Easy C++
235 Lowest Common Ancestor of a Binary Search Tree Easy C++
236 Lowest Common Ancestor of a Binary Tree Medium C++
237 Delete Node in a Linked List Easy C++
239 Sliding Window Maximum Hard C++
240 Search a 2D Matrix II Medium C++
241 Different Ways to Add Parentheses Medium C++
257 Binary Tree Paths Easy C++
260 Single Number III Medium C++
264 Ugly Number II Medium C++
268 Missing Number Medium C++
282 Expression Add Operators Hard C++
289 Game of Life Medium C++
295 Find Median from Data Stream Hard C++
297 Serialize and Deserialize Binary Tree Hard C++
312 Burst Balloons Hard C++
313 Super Ugly Number Medium C++
315 Count of Smaller Numbers After Self Hard C++
316 Remove Duplicate Letters Hard C++
318 Maximum Product of Word Lengths Medium C++
321 Create Maximum Number Hard C++
324 Wiggle Sort II Medium C++
327 Count of Range Sum Hard C++
328 Odd Even Linked List Medium C++
330 Patching Array Hard C++
337 House Robber III Medium C++
338 Counting Bits Medium C++
342 Power of Four Easy C++
347 Top K Frequent Elements Medium C++
355 Design Twitter Medium C++
367 Valid Perfect Square Medium C++
371 Sum of Two Integers Easy C++
372 Super Pow Medium C++
373 Find K Pairs with Smallest Sums Medium C++
376 Wiggle Subsequence Medium C++
377 Combination Sum IV Medium C++
378 Kth Smallest Element in a Sorted Matrix Medium C++
389 Find the Difference Easy C++
392 Is Subsequence Medium C++
393 UTF-8 Validation Medium C++
397 Integer Replacement Medium C++
401 Binary Watch Easy C++
402 Remove K Digits Medium C++
404 Sum of Left Leaves Easy C++
405 Convert a Number to Hexadecimal Easy C++
406 Queue Reconstruction by Height Medium C++
407 Trapping Rain Water II Hard C++
415 Add Strings Easy C++
421 Maximum XOR of Two Numbers in an Array Medium C++
435 Non-overlapping Intervals Medium C++
437 Path Sum III Easy C++
445 Add Two Numbers II Medium C++
449 Serialize and Deserialize BST Medium C++
450 Delete Node in a BST Medium C++
451 Sort Characters By Frequency Medium C++
452 Minimum Number of Arrows to Burst Balloons Medium C++
455 Assign Cookies Easy C++
461 Hamming Distance Easy C++
477 Total Hamming Distance Medium C++
502 IPO Hard C++
0%