这是我的 LeetCode 刷题记录。刷题顺序大部分根据 Leetcode 分类顺序表 进行,目前所有题目用 C++ 求解并有对应博文记录解题思路。方法不一定最优,欢迎补充~
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
1 | Two Sum | Solution | code |
26 | Remove Duplicates from Sorted Array | Solution | code |
66 | Plus One | Solution | code |
119 | Pascal's Triangle II | Solution | code |
121 | Best Time to Buy and Sell Stock | Solution | code |
122 | Best Time to Buy and Sell Stock II | Solution | code |
217 | Contains Duplicate | Solution | code |
412 | Fizz Buzz | Solution | code |
905 | Sort Array By Parity | Solution | code |
Medium | |||
31 | Next Permutation | Solution | code |
48 | Rotate Image | Solution | code |
54 | Spiral Matrix | Solution | code |
55 | Jump Game | Solution | code |
59 | Spiral Matrix II | Solution | code |
73 | Set Matrix Zeroes | Solution | code |
79 | Word Search | Solution | code |
442 | Find All Duplicates in an Array | Solution | code |
987 | Vertical Order Traversal of a Binary Tree | Solution | code |
Hard | |||
45 | Jump Game II | Solution | code |
123 | Best Time to Buy and Sell Stock III | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
14 | Longest Common Prefix | Solution | code |
38 | Count and Say | Solution | code |
58 | Length of Last Word | Solution | code |
67 | Add Binary | Solution | code |
125 | Valid Palindrome | Solution | code |
383 | Ransom Note | Solution | code |
520 | Detect Capital | Solution | code |
824 | Goat Latin | Solution | code |
Medium | |||
6 | ZigZag Conversion | Solution | code |
8 | String to Integer (atoi) | Solution | code |
43 | Multiply Strings | Solution | code |
151 | Reverse Words in a String | Solution | code |
165 | Compare Version Numbers | Solution | code |
Hard | |||
68 | Text Justification | Solution | code |
952 | Largest Component Size by Common Factor | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
179 | Largest Number | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
7 | Palindrome Number | Solution | code |
9 | Palindrome Number | Solution | code |
13 | Roman to Integer | Solution | code |
168 | Excel Sheet Column Title | Solution | code |
171 | Excel Sheet Column Number | Solution | code |
258 | Add Digits | Solution | code |
1103 | Distribute Candies to People | Solution | code |
Medium | |||
12 | Integer to Roman | Solution | code |
315 | Bulb Switcher | Solution | code |
Hard | |||
60 | Permutation Sequence | Solution | code |
65 | Valid Number | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
17 | Letter Combinations of a Phone Number | Solution | code |
39 | Combination Sum | Solution | code |
40 | Combination Sum II | Solution | code |
46 | Permutations | Solution | code |
47 | Permutations II | Solution | code |
77 | Combinations | Solution | code |
78 | Subsets | Solution | code |
89 | Gray Code | Solution | code |
90 | Subsets II | Solution | code |
93 | Restore IP Addresses | Solution | code |
216 | Combination Sum III | Solution | code |
1286 | Iterator for Combination | Solution | code |
Hard | |||
37 | Sudoku Solver | Solution | code |
51 | N-Queens | Solution | code |
52 | N-Queens | Solution | code |
282 | Expression Add Operators | Solution | code |
140 | Word Break II | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
70 | Climbing Stairs | Solution | code |
392 | Is Subsequence | Solution | code |
Medium | |||
5 | Longest Palindromic Substring | Solution | code |
62 | Unique Paths | Solution | code |
63 | Unique Paths II | Solution | code |
64 | Minimum Path Sum | Solution | code |
120 | Triangle | Solution | code |
139 | Word Break | Solution | code |
279 | Perfect Squares | Solution | code |
322 | Coin Change | Solution | code |
375 | Guess Number Higher or Lower II | Solution | code |
377 | Combination Sum IV | Solution | code |
967 | Numbers With Same Consecutive Differences | Solution | code |
Hard | |||
32 | Longest Valid Parentheses | Solution | code |
87 | Scramble String | Solution | code |
188 | Best Time to Buy and Sell Stock IV | Solution | code |
312 | Burst Balloons | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
342 | Power of Four | Solution | code |
389 | Find the Difference | Solution | code |
Medium | |||
137 | Single Number II | Solution | code |
201 | Bitwise AND of Numbers Range | Solution | code |
260 | Single Number III | Solution | code |
318 | Maximum Product of Word Lengths | Solution | code |
371 | Sum of Two Integers | Solution | code |
393 | UTF-8 Validation | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
211 | Design Add and Search Words Data Structure | Solution | code |
341 | Flatten Nested List Iterator | Solution | code |
380 | Insert Delete GetRandom O(1) | Solution | code |
Hard | |||
381 | Insert Delete GetRandom O(1) - Duplicates allowed | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
435 | Non-overlapping Intervals | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
205 | Isomorphic Strings | Solution | code |
242 | Valid Anagram | Solution | code |
290 | Word Pattern | Solution | code |
387 | First Unique Character in a String | Solution | code |
409 | Longest Palindrome | Solution | code |
705 | Design HashSet | Solution | code |
Medium | |||
994 | Rotting Oranges | Solution | code |
Hard | |||
149 | Max Points on a Line | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
969 | Pancake Sorting | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
20 | Valid Parentheses | Solution | code |
155 | Min Stack | Solution | code |
225 | Implement Stack using Queues | Solution | code |
232 | Implement Queue using Stacks | Solution | code |
Medium | |||
71 | Simplify Path | Solution | code |
150 | Evaluate Reverse Polish Notation | Solution | code |
227 | Basic Calculator II | Solution | code |
385 | Mini Parser | Solution | code |
388 | Longest Absolute File Path | Solution | code |
394 | Decode String | Solution | code |
983 | Minimum Cost For Tickets | Solution | code |
Hard | |||
84 | Largest Rectangle in Histogram | Solution | code |
224 | Basic Calculator | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Easy | |||
28 | Implement strStr() | Solution | code |
344 | Reverse String | Solution | code |
345 | Reverse Vowels of a String | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
3 | Longest Substring Without Repeating Characters | Solution | code |
Hard | |||
30 | Substring with Concatenation of All Words | Solution | code |
76 | Minimum Window Substring | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Hard | |||
1032 | Stream of Characters | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
130 | Surrounded Regions | Solution | code |
200 | Number of Islands | Solution | code |
Hard | |||
329 | Longest Increasing Path in a Matrix | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Hard | |||
126 | Word Ladder II | Solution | code |
127 | Word Ladder | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
215 | Kth Largest Element in an Array | Solution | code |
313 | Super Ugly Number | Solution | code |
347 | Top K Frequent Elements | Solution | code |
373 | Find K Pairs with Smallest Sums | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
133 | Clone Graph | Solution | code |
310 | Minimum Height Trees | Solution | code |
332 | Reconstruct Itinerary | Solution | code |
399 | Evaluate Division | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
207 | Course Schedule | Solution | code |
210 | Course Schedule II | Solution | code |
# | Problems | Solution | Code |
---|---|---|---|
Medium | |||
382 | Linked List Random Node | Solution | code |
384 | Shuffle an Array | Solution | code |
398 | Random Pick Index | Solution | code |