Leetcode Exercise manual
“ Follow me, left hand, right hand, a binary tree , Different styles of stack list reverse conversion ”
For the students who are going to graduate school or looking for a job ,Leetcode Maybe it's a barrier that can't be bypassed , Many technical posts in companies will take questions from the question bank . in addition , brush leetcode It is also helpful to improve our ability to apply and understand data structures and algorithms , I believe that many of you are also in pain and happy .
It will also start leetcode I'm on a journey , Specially arranged a set Leetcode Exercise manual , It can help those who haven't started or are confused . There are four different strategies , Welcome to your seat .
One , Brush question selection
It is not advisable to brush questions blindly , therefore , To brush questions, we must find out the purpose and reason . It's nothing more 4 species ：
If you want to improve your thinking ability , You can follow the AC Rate from low to high two points to find the problem matching your current level of difficulty , Then challenge the difficult questions appropriately （ Binary time complexity is O(logn), At least it's easier than it's harder O(n) Save time ）
* If you want to consolidate a topic , So naturally tag To brush the questions , But because the method used is known before solving , It's not good for the improvement of thinking ability
* If you don't understand anything , So it is suggested to brush the questions randomly , It'll give you more insight , Second, there is a large space for progress
* If you want to improve AC Rate or increase self-confidence , So it is suggested to brush the water
There is a talent difference between people , But the difference is that experience can be accumulated slowly , Another suggestion , If the problem is too difficult to exceed the current ability , After trying for a certain period of time, let's be honest and see the solution
Two , How to brush questions
Method 1 ： Sequential method
Suggest new people who have not finished the questions follow the order （AC） come . Front 150 Questions cover many classic questions and knowledge points , The pointer method class is as follows 『3 sum』 series , Dynamic gauge 『regex
matching』, Search topics such as 『Sodoku Solver』.
Basic knowledge （ chart , tree , heap , Stack , Linked list , Hashtable , Memory search , dynamic programming , Pointer method , Parallel search, etc ） after , Can be a class of label attack .Leetcode The label system on the right may not
100% complete , But the general classification is good .
Only one month before the interview 『Hard』 Title of label , Because usually after two times, for most 『Medium』 The following questions are muscle memory . Practice more 『Hard』 Class topic can make your thinking more open , Because many subjects use strange and skillful techniques which are surprising , such as
Leetcode Carefully designed serial number 『84. Largest Rectangle in Histogram』,『85. Maximal Rectangle』.
Method 2 ： Tagging
According to the different arrangement of websites tags, Play a modular review and learning role . for instance ： For example, review the contents of the linked list , Just choose Linked
List This part of 23 Topics . You can summarize the common methods, data structures and construction methods after you finish brushing . Please don't brush questions for the sake of doing so , It must be done to make up for some knowledge .
Method 3 ： Random method
Arbitrary choice of difficulty and order of brushing questions , Which do you like . This method is only suitable for amateur programming , Students who are not engaged in the industry and great gods
Method 4 ： The law of necessity
leetcode There is a question bank of the company , in a word ： Which family do you want to meet , Which house to brush
Three , Brush the topic introduction
as everyone knows , In ancient times, it was claimed that the painting was finished leetcode The God of all questions , It's just because there was only 150 Avenue . As of 2018 year 1 month ,leetcode Already 700 Questions , And part of the difficulty is not small . It's all done , Except for wasting your own time , There seems to be no other purpose .
therefore , For most people , There is no time and no need to do all the questions once （ You can do whatever you want with plenty of time ）. It can be considered that the serial number is first 250 Title of bit , Because those are all classic and required questions .
Make good use of favorites , To develop 『 Add a favorite if you can't solve a problem in the second exercise 』 The habit of , And you need to empty your favorites regularly ： You don't need to prompt to pass each question twice before you can move it out of favorites .
You can do it in the following order of interview questions frequency , Start with the most frequent batch . And try not to use it IDE, Write code directly on the platform .
Members can be purchased before the interview , Practice according to the company's label , Can also be combined with whiteboard practice . If time is tight before the interview , So the priorities of the exercises are ： About to interview the company , Old topics in favorites , Remaining new questions .
Please try not to open the question type label for sprint practice , Give yourself space to think . If I brush it three times or more, I can't reach my ideal goal , Then there must be something wrong with the learning method , Please sum up .
Don't commit until you've written your code , Check the code manually , For example, whether semicolons are written ,return Do you wait less . Use after manual inspection “Custom
Testcase” Function custom test case , Pay attention to check the boundary , then “Run Code”, Many problems can be found in this step . etc. RunCode After passing , Submit again .
Last attached Lnho <http://blog.csdn.net/lnho2015/article/details/50962989>
The order in which the great God used to brush questions , Although some have been adjusted , But on the whole, the topic is absolutely classic ：
The frequency of occurrence is 5：
1. Leet Code OJ 1. Two Sum [Difficulty: Easy]
2. Leet Code OJ 8. String to Integer (atoi) [Difficulty: Easy]
3. Leet Code OJ 15. 3Sum [Difficulty: Medium]
4. Leet Code OJ 20. Valid Parentheses [Difficulty: Easy]
5. Leet Code OJ 21. Merge Two Sorted Lists [Difficulty: Easy]
6. Leet Code OJ 28. Implement strStr() [Difficulty: Easy]
7. Leet Code OJ 56. Merge Intervals [Difficulty: Hard]
8. Leet Code OJ 57. Insert Interval [Difficulty: Hard]
9. Leet Code OJ 65. Valid Number [Difficulty: Hard]
10. Leet Code OJ 70. Climbing Stairs [Difficulty: Easy]
11. Leet Code OJ 73. Set Matrix Zeroes [Difficulty: Medium]
12. Leet Code OJ 88. Merge Sorted Array [Difficulty: Easy]
13. Leet Code OJ 98. Validate Binary Search Tree [Difficulty: Medium]
14. Leet Code OJ 125. Valid Palindrome [Difficulty: Easy]
15. Leet Code OJ 127. Word Ladder [Difficulty: Medium]
The frequency of occurrence is 4：
1. Leet Code OJ 2. Add Two Numbers [Difficulty: Medium]
2. Leet Code OJ 12. Integer to Roman
3. Leet Code OJ 13. Roman to Integer
4. Leet Code OJ 22. Generate Parentheses
5. Leet Code OJ 23. Merge k Sorted Lists
6. Leet Code OJ 24. Swap Nodes in Pairs
7. Leet Code OJ 27. Remove Element [Difficulty: Easy]
8. Leet Code OJ 46. Permutations
9. Leet Code OJ 49. Anagrams
10. Leet Code OJ 67. Add Binary
11. Leet Code OJ 69. Sqrt(x)
12. Leet Code OJ 77. Combinations
13. Leet Code OJ 78. Subsets
14. Leet Code OJ 79. Word Search
15. Leet Code OJ 91. Decode Ways [Difficulty: Medium]
16. Leet Code OJ 102. Binary Tree Level Order Traversal [Difficulty: Easy]
17. Leet Code OJ 129. Sum Root to Leaf Numbers
18. Leet Code OJ 131. Palindrome Partitioning