Leetcode has 500 questions, is the written test/interview stable? Talk about algorithm learning

Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning

If you want to learn algorithms, deal with written exams, or deal with hand-tear algorithm questions in interviews, I believe most people will brush Leetcode. Any readers ask? If I insist on writing 500 questions in Leetcode, will the written test/interview be stable in the future?

Here I will talk about my personal opinion, which I think is unstable. Let's talk about the reasons for instability and how to brush and learn algorithm problems. Of course, I will also recommend the materials I have learned.

1. Let me talk about the written test first

When brushing the leetcode, you will find that the meaning of each question is very short. You only need to spend more than ten seconds to know what the question is for you, and the algorithm used for each question The thinking is very clear, dynamic programming, recursion, binary search, etc., you may soon know which method to use, but you don't know how to write the code.

In the written test, it is completely different. In the written test, most of the questions are situational questions. It may take a lot of time to understand a question. Occasionally, I don’t know what the question is about. Time limit, it is estimated that the time allocated to you for each question is 30 minutes. Here I just throw a question for everyone to see (Shopee's real question last year)

Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning
And it may not be easy for you to see what method should be used for these questions, it may be a combination of multiple methods (of course, not referring to this question).

In other words, in Leetcode, hard-level questions are done, while in the written test, medium-level questions are affected by factors such as time and mentality. You may not be able to do it yet, of course, except for the big guys. Let me talk about some of the question types and how to learn the algorithm will be easier to deal with.

In the written test, I think there are mainly the following types of questions:

1. Investigation of basic data structure: I think this kind of question is relatively simple. The operation of the basic data structure of the main examination room, such as the traversal of the binary tree level, the reverse order of the linked list, etc. Of course, it will not tell you directly, let you come Reverse order or traverse. E.g

Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning
2. The mastery of a certain algorithmic idea: This kind of problem will be easier if you master a certain algorithmic idea. If you don't understand it, it will be cool. For example, dynamic programming, backtracking, enumeration, depth/breadth, greed, dichotomy, etc. Among them, I think there are a lot of tests for dynamic programming, but also backtracking + depth/breadth. E.g
Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning

Therefore, common algorithm ideas must be mastered.
3. Investigation of boundary conditions: This type of question is estimated to have an idea at a glance and know how to do it. However, it has a lot of boundary conditions and needs to be discussed in many situations, which is particularly error-prone, sometimes it will cause People get stuck in, and the more they do, the more complicated they are. This type of question mainly examines your rigorous thinking. E.g
Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning

4. Finding laws and mathematical formulas: This type of question is mainly based on some relationships between data, to find some rules, and then to introduce their general formulas, just like when we were in high school, we looked for the same items in a series of numbers. E.g
Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning

2. How should I write the questions? How to learn?

The above mentioned some situations of the written examination questions, and also mentioned some of the main types of questions. Regarding these question types, I think you have to do the following things when writing questions.

1. Classification/Summary

induction? to sum up? It is estimated that most of them know about induction and summarization, but I don’t know if I have practiced it.

(1), array and related question types

For algorithmic questions, there are still many question types that need to be summarized. If you understand this question type and encounter similar questions in the future, I believe you will be able to do it soon. What question types can be summarized? The answer is very many: for example

(1), give you an array of non-negative numbers, find the length of the maximum sub-array sum

This can be regarded as a question type. There are many variations and extensions of this question type. It is recommended to summarize them together, such as

(2) The array just given is non-negative. Now change it. The given array can be positive or negative.

Can it continue to expand? The answer is yes, for example

(3) Give you a matrix (ie a two-dimensional array), find the area of ​​the largest sub-matrix sum

Are there any more? Yes, for example, I was seeking the maximum sum just now, but now I change it to seeking the maximum product.

I cite the above examples just to tell you that for the preliminary study, I suggest to classify the questions and summarize the question types. Like the examples I mentioned above, they are relatively common in written examinations/interviews. If you know the corresponding methods , You can kill in seconds, because this type of question has no boundaries or rules. For example, the question about Shopee’s snack cabinet that I just distanced from is actually an array cutting question type, which is equivalent to giving you an array and letting you cut n, then you can cut the array into n + 1 sub-arrays, how to cut, Can the sum of the largest sub-array be the smallest?

There are still many question types. I can't list them one by one here. I can only rely on your classification and summary in the process of writing the questions. But I can recommend some information for you, and I recommend it later. Let me talk about some question types below.

(2) Questions related to basic data structure operations

Just now, I said that in the inspection of written test questions, there is a type of test room for basic data structure. Moreover, this type of question is also a high-frequency test center in interviews. In the written test, it is not very frequent. For this kind of questions, I think you are willing to summarize, so if you encounter it in the future, the problem is not big. E.g

Various operations of the linked list: reverse order (partial reverse order, reverse order according to certain conditions), determine whether there is a ring, the entry node of the ring, delete the specified node, etc.

Various operations of the binary tree: various non-recursive traversal operations (front, middle, back, level), the common ancestor of the binary tree, reconstruction of the binary tree based on the traversal results of the front, middle and back, and so on.

Queue and stack related operations: minimum stack, come queue to achieve stack, etc.

(3) String related issues

I have to say that string-related problems are estimated to be the most frequently tested, and I can tell you that 90% of string-related problems can be solved by dynamic programming. Anyway, for string issues, my general idea is whether dynamic programming can be applied, there are a lot of string issues, but if you have time, I suggest a summary. For example: wildcard matching, longest common substring, minimum editing cost, longest palindrome, etc. Most of them use dynamic programming, and I think the solutions are similar, so it is strongly recommended to spend a period of time to do, summarize, and summarize. I will also write articles on algorithms in this area later, so stay tuned.

2. Think more/do more to improve your own thinking integrity/sensitivity

(1) Question type of boundary and finding rules

Just now I said that there is a type of question that has very many boundaries. For this type of question, I think it is difficult to summarize. This type of question examines whether your logic is rigorous and whether it can be simplified. Here I suggest to do a few more. When doing it, think about it by yourself. Don’t think that you know the idea and how to write by yourself. It’s just that there are too many situations. Write lazily. Just look at other people’s answers. Doing it is not of great value, because this type of question is to check the integrity of your thinking. It is best to do it yourself. Maybe you have used more than a dozen if statements. Then you can simplify your if statement and find what they have in common. Finally, you can see what the big guys are doing, your gain will be even greater!

By the way, don't rush to write, you should think about the feasibility, otherwise you will easily fall into a bottomless abyss.

The same is true for the question type of finding a pattern. Don’t rush to see the answer at the end of this type of question. You should think more and do a few more. If you do more, your thinking will become more and more sensitive. When you see this type of question in the future, you can Soon there are ideas.

Therefore, for this kind of boundary and law questions, I personally feel that the value of the summary is not particularly great, but more thinking and more hands-on.

Note: For each problem, we have to pursue the optimal solution. Don't think that it will be over after ac.

3. Some materials I have read

I have said so much above, maybe some people know the truth, but I still can't learn it. To be honest, there are many learning methods, and everyone’s learning methods are different. I am just providing a reference here. However, no matter what the method is, if you don't do it yourself, then everything is empty talk.

Here I recommend some books I have read, and they feel pretty good.

The books and videos involved in the article can be obtained by replying to "Algorithm Learning" on my WeChat public account "The Hardcore Code Farmer"

1. Book recommendation

I just talked about many types of questions. As for the summary of the question types, the first recommendation is "Programmer Code Interview Guide: The Best Solutions for IT Famous Companies Algorithms and Data Structure Questions". This book is really good, most of the questions The type is summarized, and each topic has more than ten or twenty. I suggest you buy it and learn.

There is also a book I read in my freshman year, and it feels pretty good. It is called "Challenge Programming Contest", but this book is more suitable for people who are not in a hurry for interviews. This book is not like the one above. Type to meet the interview.

"The Beauty of Programming" and "Programming Pearls" are also recommended. I think these two books are more interesting. It does not mean that you can keep reading questions. You can buy these two books and have a look. They will bring you some ideas. I just read these two books without coding.

When Leetcode brushes the questions, you can also brush the questions in different types, so you can also go to Leetcode to brush the questions, but when brushing the questions, I have a suggestion here, that is, don't write code in the local IDE, just write directly on the web page. Because during the interview, you are usually asked to write code in Notepad, not an IDE. If you are not used to it, it is easy to write wrong code, and you have forgotten the names of some library functions. The web side is actually very convenient, and there will be some code hints.

For students who don’t even understand various algorithm ideas and data structures, the above data is not suitable. I recommend the two books I have read "Data Structure and Algorithm Analysis-C Language Description Edition" and "Algorithm Design And analysis basis" (this code is implemented in pseudo code).

2. Video recommendation

When I said that, I don’t watch many videos. I’m not used to watching videos for algorithm learning, especially for brushing questions. If you want to watch videos, I think Niuke’s algorithm videos are pretty good. Set, divided into elementary class and advanced class. I haven't read the others, so there are not many recommendations here.

Four, summary

Back to the title, is Leetcode stable with 500 questions? To be honest, if you can insist on 500 questions, it shows that your ability is quite strong, but for the written test, I don’t think it is stable. It depends on how you do it, such as whether to pursue the optimal solution, whether to summarize, or say You just ignore it after violent ac, or don't dare to jump out of your comfort zone, and always do those questions that are better than you originally were, and when you encounter weak questions, you immediately look at the answers. And as I said, some questions are about finding patterns or having a lot of boundaries. These kinds of questions require you to think and do something more, not that I can just do a few more.

In short, when it comes to brushing questions, don't pursue quantity!

The above method of doing questions may not be suitable for everyone, but my own study and suggestions for your reference. If you want to get the above information, you can get it by replying to "Algorithm Learning" on my official account "The Hardcore Code Farmer".

Today is the last day of the holiday, everyone has had enough, so next, we must study hard and improve our hard power first. Later, I will also write more algorithmic questions, such as dynamic programming, backtracking, recursion, etc.

Recommended reading

[Hematemesis finishing] Those basic computer knowledge that made you take off: what and how to learn?

After two months, my autumn move is over!

What are the tricks in the algorithm data structure?

Leetcode has 500 questions, is the written test/interview stable?  Talk about algorithm learning

Guess you like

Origin blog.51cto.com/15015171/2554947