作者:empty 页数:1743 出版社:empty |
为什么开始刷题?需要很久才能再想起来,于是就萌发了刷一题总结一题的想法。另一方面, leet code上的discuss里一些解, 有时候讲解的很少, 甚至只丢一些代码, 对于我等这种菜鸟有时候看的太废劲了,所以不如自己把各种解法都理清楚,然后详细的总结出来,也方便其他人更好的理解。
大一的时候, 听过ACM, 然后暑假也去学校的ACM集训试了试, 但当时基础太差了, 栈和队列都不知道是什么, 所以也就没有走上ACM的道路。之后就各种学安卓、web、后端的应用开发的一些东西了。后来准备开始刷题是大四毕业的时候了吧。当时对回溯、动态规划也都只是上课的时候学过,也并不熟练。开始几题的时候,也都很慢,很多都自己想不出来。然后就去看别人的题解。看完以后,就什么都不看,然后按自己的思路再写一遍代码。尤其是第5题,求最长回文序列,现在都印象深刻,记得当时用了好几天才把所有解法总结了出来。所以大家如果想刷题的话,也不用怕自己基础不好,大不了哪些名词不会就去查,一点点积累就可以,重要的是开始和坚持。现在的感觉
从开始可能只是觉得该刷一刷题,到现在可能真的是爱上了刷题。现在刷题基本可以想出一种思路,有时候甚至和最优解想到了一起,还会想出一些别人没有想到的解法,这种成就感可能就是打游戏超神的感觉吧,哈哈。此外, 看discuss的时候, 每当看到令人拍案称奇的思路的时候, 真的是让人心旷神怡, 开心的不得
leet code 100斩!回顾
leet code力扣刷题1到300的感受
1.Two Sum
2.Add Two Numbers
3.Longest Substring Without Repeating Characters
4*.Median of Two Sorted Arrays
5*.Longest Palindromic Substring
6.ZigZag Conversion
7, Reverse Integer
8.5tring to Integer
9.Palindrome Number
10.RegularExpression Matching
11.Container With Most Water
12.Integer to Roman
13.Roman to Integer
14.Longest Common Prefix
15.3Sum
16.35um Closest
17.Letter Combinations of a Phone Number
18.4Sum
19.Remove Nth Node From End of List
20.Valid Parentheses
21.Merge Two Sorted Lists
22.Generate Parentheses
23.Merge k Sorted Lists
24.Swap Nodes in Pairs
25.Reverse Nodes ink-Group
26.Remove Duplicates from Sorted Array
27.Remove Element
28.1mplementstrStr()
29.Divide Two Integers
30.Substring with Concatenation of All Words
31.Next Permutation
32.Longest Valid Parentheses
33.Search in Rotated Sorted Array
34.Find First and Last Position of Element in Sorted Array
35.Search Insert Position
36.Valid Sudoku
37.Sudoku Solver
38.Count and Say
39.Combination Sum
40.Combination Sum II
41.First Missing Positive
42.Trapping Rai Water
43.Multiply Strings
44.Wildcard Matching
45.Jump Game lI
46.Permutations
47.Permutations I
48.Rotate Image
49.Group Anagrams
50*.Pow(x, n)
51.N-Queens
52.N-Queens II
53.Maximum Subarray
54.Spiral Matrix
55.Jump Game
56.Merge Intervals
57.Insert Interval
58.Length of Last Word
59.Spiral Matrix II
60.Permutation Sequence
61.Rotate List
62.Unique Paths
63.Unique Paths II
64.Minimum Path Sum
65.Valid Number
66.Plus One
67.Add Binary
68.TextJustification
69.Sq it x
70.Climbing Stairs
71.Simplify Path
72.Edit Distance
73.SetMatrix Zeroes
74.Search a2D Matrix
75.Sort Colors
76.Minimum Window Substring
77.Combinations
78.Subsets
79.WordSearch
80.Remove Duplicates from Sorted Array II
81.Search in Rotated Sorted Array I
82.Remove Duplicates from Sorted List II
83.Remove Duplicates from Sorted List
84.Largest Rectangle in Histogram
85.Maximal Rectangle
86.Partition List
87.Scramble String
88.Merge Sorted Array
89.Gray Code
90.Subsets I 1
91.Decode Ways
92.Reverse LinkedList II
93.Restore IP Addresses
94.Binary Tree In order Traversal
95*.Unique Binary Search Trees II
96.Unique Binary Search Trees
97.Interleaving String
98.Validate Binary Search Tree
99.Recover Binary Search Tree
100.Same Tree
101题到200题
101.Symmetric Tree
102.Binary Tree Level Order Traversal
103.Binary Tree Zigzag Level Order Traversal
104.Maximum Depth of Binary Tree
105.Construct Binary Tree from Preorder and In order Traversal
106.Construct Binary Tree from In order and Post order Traversal
107.Binary Tree Level Order Traversal II
108.Convert Sorted Array to Binary Search Tree
109.Convert Sorted List to Binary Search Tree
110.Balanced Binary Tree
111.Minimum Depth of Binary Tree
112.Path Sum
113.Path Sum II
114.Flatten Binary Tree to LinkedList
115*.Distinct Subsequences
116.Populating Next Right Pointers in Each Node
117.Populating Next Right Pointers in Each Node II
118.Pascal's Triangle
119.Pascal's Triangle II
120.Triangle
121.Best Time to Buy and Sell Stock
122.Best Time to Buy and Sell Stock I
123*.Best Time to Buy and Sell Stock IlI
124*.Binary Tree Maximum Path Sum
125.V all d Palindrome
126*.Word Ladder I
127.Word Ladder
128.Longest Consecutive Sequence
129.Sum Root to Leaf Numbers
130*, Surrounded Regions
131.Palindrome Partitioning
132.Palindrome Partitioning II
133.Clone Graph
134.Gas Station
135.Candy
136.Single Number
137*.Single Number II
138.Copy Lise with Random Pointer
139.Wu rd Break
140.Word Break II
141.LinkedList Cycle
142.LinkedList Cycle I
143.Reorder List
144.Binary Tree Preorder Traversal
145*.Binary Tree Post order Traversal
146.LRU Cache
147.Insertion Sort List
148.Sort List
149*.MaxPoints on a Line
150.Evaluate Reverse Polish Notation
151.Reverse Words in a String
152.Maximum Product Subarray
153.Find Minimum in Rotated Sorted Array
154*, Find Minimum in Rotated Sorted Array Il
155.Min Stack
160.Intersection of Two Linked Lists
162.Find Peak Element
164.Maximum Gap
165.Compare Version Numbers
166.Fraction to Recurring Decimal
167.Two Sum II-Input array is sorted
168.Excel Sheet Column Title
169.Majority Element
171.Excel Sheet Column Number
172.Factorial Trailing Zeroes
173.Binary Search Tree Iterator
174*, Dungeon Game
179.Largest Number
187.Repeated DNA Sequences
188.Best Time to Buy and Sell Stock IV
189.Rotate Array
190.Reverse Bits
191.Number of 1Bits
198.House Robber
199.Binary Tree Right Side View
200.Number of Islands
201.Bitwise AND of Numbers Range
202.Happy Number
203.Remove LinkedList Elements
204.Count Primes
205.Isomorphic Strings
206.Reverse LinkedList
201题到300题
207.Course Schedule
208.1mplementTrie(Prefix Tree)
209.MinimumSize Subarray Sum
210.Course Schedule I
211.Add and Search Word-Datastructure design
212.WordSearch II
213.House Robber H
214*.Shortest Palindrome
215.Kth Largest Element in an Array
216.Combination Sum III
217.Contains Duplicate
218.The Skyline Problem
219.Contains Duplicate II
220*, Contains Duplicate III
221.Maximal Square
222.Count Comple ce Tree Nodes
223.Rectangle Area
224*.Basic Calculator
225.Implement Stack using Queues
226.Invert Binary Tree
227.Basic Calculator II
228.Summary Ranges
229.Majority Element II
230.Kth Smallest Element in aBST
231*.Power of Two
232.Implement Queue using Stacks
233.Num her of Digit One
234.Palindrome LinkedList
235.Lowest Common Ancestor of a Binary Search Tree
236.Lowest Common Ancestor of a Binary Tree
237.Delete Node in a LinkedList
238.Product of Array Except Sel
239.Sliding Window Maximum
240.Search a2DMatrixII
241.Different Ways to Add Parentheses
242.Valid Anagram
257.Binary Tree Paths
258.Add Digits
260.5ingle Number III
263.Ugly Number
264.Ugly Number II
268.Missing Number
273.Integer to English Words
274.H-Index
275.H-Index II
278.First Bad Version
279.Perfect Squares
282.Expression Add Operators
283.Move Zeroes
284.Peeking Iterator
287+, Find the Duplicate